File Management  «Prev  Next»

Unix File Management - Quiz

Each question is worth one point. Select the best answer or answers for each question.
1. Which command displays the stored target pathname of the symbolic link qa.html, without requesting dereferencing?
Please select the best answer.
  A. ln -s qa.html
  B. ls -F qa.html
  C. ls -a qa.html
  D. ls -l qa.html

2. Assume GNU rm is used directly, without aliases or additional options. Which two statements about rm -r directory are correct?
Please select exactly two answers.
  A. It works only when directory is empty.
  B. It attempts to remove directory and its contents recursively, subject to permissions and other restrictions.
  C. It always asks for confirmation before removing every file.
  D. For an unwritable file, it normally asks for confirmation when standard input is a terminal and -f is not specified.

3. directory1 and directory2 are existing ordinary directories, directory2 is outside directory1, and directory2/directory1 does not exist. Assume all required source access and destination permissions are available. Which command copies directory1 and its contents into directory2?
Please select the best answer.
  A. cp directory1 directory2
  B. cp -i directory1 directory2
  C. cp -R directory1 directory2
  D. mv directory1 directory2

4. You want to save matching regular-file paths to a text file named page_list. Which two changes correct the following command for reliable shell use? find ../project -type f -name *.htm | page_list
Please select exactly two answers.
  A. Remove -type f because find cannot combine tests.
  B. Quote the pattern as '*.htm' so the shell passes it unchanged to find.
  C. Replace the pipe with > page_list to write the output, or >> page_list to append it.
  D. Replace ../project because find cannot accept parent-directory paths.

5. A symbolic link named /home/alex/shortcuts/qa.html stores the relative target ../project/qa/test_plan.html. From which directory is that target pathname resolved when the link is followed?
Please select the best answer.
  A. The current working directory of the person opening the link.
  B. /home/alex/shortcuts, the directory containing the link.
  C. The filesystem root directory, regardless of the link location.
  D. The directory in which the ln command was originally run.