220-1102 Question 235
Single answerlsA Linux support technician is troubleshooting a user's home directory and needs to verify which files are hidden, confirm file permissions, and see whether a recent script is executable. Which command should the technician use to display this information in a single step?
- A
ls -l
- B
ls -a
- C
ls -la
- D
ls -R
Show answer and explanation
Correct answer: C
Explanation
The best answer is ls -la because it satisfies all stated needs in one command: showing hidden files and displaying detailed file metadata, including permissions. In Linux, hidden files typically begin with a dot, and the -a option includes them in the output. The -l option provides the long format, where the first column shows permission bits that indicate whether a file is executable. This aligns with standard Linux command-line usage documented in the ls manual pages (for example, man ls on most distributions). For A+ Core 2, candidates should recognize practical command usage in support scenarios, especially when verifying permissions and identifying hidden configuration files in user directories.
- A. Incorrect.
ls -l displays files in long format, including permissions, ownership, size, and timestamps. However, it does not show hidden files unless the -a option is also used. A technician choosing this may understand the need to check permissions but miss the requirement to view hidden files such as those beginning with a dot.
- B. Incorrect.
ls -a displays all files, including hidden files that start with a period. However, it does not provide the long listing details needed to verify permissions or whether a script has the execute bit set. This is a common partial answer when someone focuses only on hidden files.
- C. Correct.
ls -la combines the long listing format (-l) with showing all files, including hidden ones (-a). This allows the technician to see hidden files, file permissions, ownership, size, and timestamps in one command. The permission field clearly shows whether a script is executable, such as -rwxr-xr-x.
- D. Incorrect.
ls -R lists directories recursively, which can be useful when examining nested folders, but it does not automatically show hidden files or detailed permissions unless combined with other switches. By itself, it does not meet the scenario requirements.