LFCA practice question 13 of 15
What command do you use to view the structure of system directory hierarchies?
Full set: 60 questionsDomain Linux Fundamentals
The tree command is a standard Linux utility specifically designed to recursively list or display the contents of a directory in a depth-indented, tree-like format. This visual representation directly shows the hierarchical structure of directories, subdirectories, and files, starting from a specified root directory (or the current directory if none is given). It is the most appropriate and direct tool for the task described in the question, which is to view the structure of directory hierarchies.
B. fee | ls /etc: fee is not a standard command, and this command structure is syntactically incorrect for viewing a directory hierarchy.
C. ls -t: This command lists the contents of a directory sorted by modification time; it does not display the hierarchical structure.
D. ls tree: This command would attempt to list the contents of a file or directory literally named "tree", not execute the tree utility. ---
1. Official Vendor Documentation (man page): The tree manual page provides the definitive description of the command's function.
Source: tree(1) — Linux manual page.
Reference: In the "NAME" section, it states: "tree - list contents of directories in a tree-like format." The "DESCRIPTION" section further elaborates that "Tree is a recursive directory listing program that produces a depth indented listing of files."
2. University Courseware: Reputable computer science courses often introduce tree as a fundamental tool for filesystem visualization.
Source: MIT, "The Missing Semester of Your CS Education," Lecture 2: Shell Tools and Scripting.
Reference: In the "Files and Directories" section, the course notes demonstrate the use of tree to visualize directory structures, contrasting it with the flat listing provided by ls.
3. Official Vendor Documentation (Red Hat): Major Linux distribution documentation covers essential command-line utilities.
Source: Red Hat Enterprise Linux 9 Documentation, "Configuring basic system settings," Chapter 2. Working with the command line.
Reference: Section 2.1.3, "Listing files and directories," describes the ls command and its options. While tree may not be installed by default, its function is distinct from ls, which is used for listing contents, not displaying the full hierarchical structure recursively in a visual format. This distinction highlights why ls -t is incorrect.
Keep practicing
Take the free LFCA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other LFCA practice questions
- Question 1Which measures can be taken to prevent unauthorized access to cloud instances and service…
- Question 2Which of the following is considered a best practice for hardening SSHD?
- Question 3An IT team needs to synchronize large amounts of data between two nodes on the company’s …
- Question 4Which of the following commands can be used to lock a user’s account so that they cannot …
- Question 5Which of the following best describes serverless computing?
- Question 6A server on the network is unreachable. What is the best method to verify connectivity be…
