















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















































Exploring Linux Filesystems – 150 Review Questions with Answers and Rationales Total Questions: 150 | All Questions Multiple Choice (including Select-All-That-Apply) This comprehensive 150-question study guide is designed for students preparing for the CompTIA Linux+ certification exam, covering Chapter 3:
file navigation commands, file types and permissions, absolute and relative pathnames, wildcard metacharacters, text file viewing and editing, binary file examination, and the vi text editor. Each question includes the correct answer with a detailed rationale to reinforce understanding of essential Linux filesystem concepts.
Question 1 A directory is a type of file. True or False? A) True B) False Answer: A Rationale: In Linux, everything is a file, including directories. A directory is a special type of file that contains a list of filenames and their corresponding inode numbers.
Question 2 Which command would a user type on the command line to find out which directory in the directory tree he is currently located in? A) pd B) cd C) where D) pwd Answer: D Rationale: The pwd (print working directory) command displays the absolute pathname of the current working directory. Question 3 Which of the following is an absolute pathname? (Choose all that apply.) A) Home/resume B) C:\myfolder\resume C) resume D) /home/resume E) C:home/resume Answer: B, D Rationale: An absolute pathname starts from the root directory (or root of the filesystem). In Linux, /home/resume is absolute. In Windows-style paths (as used in some contexts), C:\myfolder\resume is absolute. Relative pathnames do not start with a leading slash or drive letter. Question 4 A special device file is used to: A) Enable proprietary custom-built devices to work with Linux B) Represent hardware devices such as hard disk drives and ports C) Keep a list of device settings specific to each individual user D) Do nothing in Linux
Question 7 After typing the ls -F command, you notice a filename that ends with an * (asterisk) character. What does this mean? A) It is a hidden file. B) It is a linked file. C) It is a special device file. D) It is an executable file. Answer: D Rationale: The -F option of the ls command appends a special character to indicate the file type. An asterisk (*) indicates that the file is executable. Question 8 After typing the ls -F command, what special character indicates a linked file? A) * B) @ C) / D) | Answer: B Rationale: The -F option appends @ to indicate a symbolic link (linked file). Question 9 Linux uses a logical directory tree to organize files into different folders. True or False? A) True B) False Answer: A Rationale: Linux organizes files in a hierarchical directory tree structure, starting from the root directory (/).
Question 10 If resume is the name of a file in the home directory off the root of the filesystem and your present working directory is home, what is the relative name for the file named resume? A) /home/resume B) /resume C) resume D) \home\resume Answer: C Rationale: A relative pathname is specified relative to the current working directory. If the current directory is home and the file resume is in that directory, the relative name is simply resume. Question 11 Linux can have only one root directory per directory tree. True or False? A) True B) False Answer: A Rationale: Every Linux filesystem has exactly one root directory (/), which is the top of the directory hierarchy. Question 12 What command can be issued to confirm what directory you are in at a command line prompt? A) ls B) cd C) pwd D) dir Answer: C Rationale: The pwd (print working directory) command displays the full pathname of the current directory.
Answer: C Rationale: From /home/jim/sales/pending, using cd ../.. moves up two levels to /home/jim. Question 16 The root directory of a Linux filesystem is represented by which symbol? A) B) / C) ~ D). Answer: B Rationale: The root directory in Linux is represented by a forward slash (/). All other directories and files are organized under this root directory. Question 17 What is the purpose of the ~ (tilde) character in the Linux shell? A) It represents the root directory B) It represents the current directory C) It represents the user's home directory D) It represents the parent directory Answer: C Rationale: The tilde (~) is a shell shortcut that represents the current user's home directory. Question 18 What does the single dot (.) represent in a Linux filesystem? A) The root directory B) The current directory
C) The parent directory D) The user's home directory Answer: B Rationale: In Linux, a single dot (.) represents the current directory. It is commonly used in commands to reference the current working directory. Question 19 What does the double dot (..) represent in a Linux filesystem? A) The root directory B) The current directory C) The parent directory D) The user's home directory Answer: C Rationale: In Linux, the double dot (..) represents the parent directory of the current working directory. Question 20 Which command is used to display the absolute pathname of the current working directory? A) ls B) cd C) pwd D) echo $PWD Answer: C Rationale: The pwd command prints the absolute pathname of the current working directory. The echo $PWD command achieves the same result.
interpreted relative to the current working directory. file.txt is a relative pathname. Question 24 What does the cd command do when used without any arguments? A) Changes to the root directory B) Changes to the user's home directory C) Changes to the previous directory D) Displays the current directory Answer: B Rationale: When cd is used without arguments, it changes the current working directory to the user's home directory. Question 25 What does the cd - command do? A) Changes to the root directory B) Changes to the user's home directory C) Changes to the previous directory D) Displays the current directory Answer: C Rationale: The cd - command changes to the previous working directory. It is useful for toggling between two directories. Question 26 A user's current directory is /home/alice/projects. Which command would change to the directory /home/alice? A) cd .. B) cd /home/alice
C) cd ~ D) All of the above Answer: D Rationale: All three commands work: cd .. moves up one level, cd /home/alice uses an absolute path, and cd ~ moves to the home directory (which is /home/alice). Question 27 What is the difference between an absolute pathname and a relative pathname? A) Absolute pathnames start from the root directory; relative pathnames start from the current directory B) Absolute pathnames start from the current directory; relative pathnames start from the root directory C) Absolute pathnames are always shorter than relative pathnames D) There is no difference Answer: A Rationale: An absolute pathname begins with a slash (/) and specifies the full path from the root directory. A relative pathname does not begin with a slash and is interpreted relative to the current working directory. Question 28 A user is in the directory /usr/local/bin. Which command would change to the /usr/local/share directory? A) cd ../share B) cd /usr/local/share C) cd share D) Both A and B Answer: D Rationale: Both cd ../share (relative path moving up one level then into share) and cd /usr/local/share (absolute path) will work.
Question 31 Which switch can be added to the ls command to show a list of files and their type? A) -l B) -a C) -F D) -R Answer: C Rationale: The -F option appends a special character to indicate file type (/ for directories, * for executables, @ for symbolic links). Question 32 In a file listing, the 9 characters following the file type (for example, -rwxr-xr- x) refer to the file's: A) Size B) Permissions C) Owner D) Date modified Answer: B Rationale: The 9 characters after the file type in an ls -l listing represent the file's permissions (read, write, execute for owner, group, and others). Question 33 What command is most effective at identifying different types of files? A) ls B) file C) type D) stat Answer: B Rationale: The file command examines a file's content and determines its type (e.g., text, binary, executable, image).
Question 34 When issuing the ls -F command, what special character indicates a linked file? A) * B) @ C) / D) | Answer: B Rationale: The -F option appends @ to indicate a symbolic link (linked file). Question 35 What will the following wildcard regular expression return: file[a-c]? A) filea-c B) filea, filec C) filea, fileb, filec D) fileabc Answer: C Rationale: The bracket expression [a-c] matches any single character in the range a, b, or c. So file[a-c] matches filea, fileb, and filec. Question 36 A user types in the command head /poems/mary. What will be displayed on the terminal screen? A) The first line of the file mary B) The header for the file mary C) The first 20 lines of the file mary D) The last 10 lines of the file mary E) The first 10 lines of the file mary
Answer: B Rationale: The tac command displays a file with the lines in reverse order (last line first). Question 40 What command can be used to search for and display any text contents of a binary file? A) text B) strings C) od D) less Answer: B Rationale: The strings command extracts and displays any human-readable text strings from a binary file. Question 41 Which command searches for and displays any text contents of a binary file? A) grep B) strings C) od D) file Answer: B Rationale: The strings command displays the printable character sequences found in binary files. Question 42 The command strings /bin/echo displays the raw binary characters inside the /bin/echo binary executable program. True or False?
A) True B) False Answer: B Rationale: The strings command displays only the human-readable text strings found in a binary file, not the raw binary characters. Question 43 Which of the following commands displays the contents of a file page by page? A) cat B) less C) more D) Both B and C Answer: D Rationale: Both less and more display file contents page by page. less offers more functionality (e.g., backward scrolling). Question 44 What is the default number of lines displayed by the head command? A) 5 B) 10 C) 20 D) 50 Answer: B Rationale: By default, the head command displays the first 10 lines of a file. Question 45 What is the default number of lines displayed by the tail command?
Question 48 What does the ls -l command display? A) A simple list of filenames B) A detailed list including permissions, owner, size, and modification time C) A list of hidden files only D) A recursive list of all subdirectories Answer: B Rationale: The ls -l (long format) command displays detailed information including file type, permissions, number of links, owner, group, size, modification date, and filename. Question 49 What does the ls -a command display? A) Only regular files B) Only directories C) All files including hidden files D) Only hidden files Answer: C Rationale: The -a option displays all files including hidden files (those beginning with a dot). Question 50 What does the ls -R command do? A) Displays files in reverse order B) Displays files recursively through subdirectories C) Displays files with read permissions only D) Displays files with relative pathnames Answer: B Rationale: The -R (recursive) option lists the contents of directories recursively, showing all subdirectories and their contents.
Question 51 What does the ls -ltr command do? A) Lists files in a simple format B) Lists files in long format, sorted by modification time in reverse order C) Lists files in long format, sorted by size D) Lists files recursively Answer: B Rationale: The ls -ltr command combines options: -l (long format), -t (sort by modification time), and -r (reverse order). This lists files with the newest files last. Question 52 Which command displays the type of a file? A) type B) file C) ls -l D) stat Answer: B Rationale: The file command determines the type of a file by examining its content. Question 53 Which command displays detailed information about a file, including permissions, size, and timestamps? A) ls -l B) stat C) file D) Both A and B