Difficulty: Easy
Correct Answer: ls -l -d
Explanation:
Introduction / Context:
Sometimes you need metadata about a directory (its mode bits, owner, size on disk, and timestamps) instead of the names it contains. The ls command provides a way to list the directory entry itself, which is essential for permission troubleshooting and scripting around directory attributes.
Given Data / Assumptions:
Concept / Approach:
The -d option tells ls to list directories themselves, not their contents. Combining with -l (long format) shows permissions, ownership, size, and timestamp. For example, ls -ld /var/log outputs the metadata for /var/log as a single line, rather than enumerating files within it.
Step-by-Step Solution:
Verification / Alternative check:
Compare ls -l /tmp (lists contents) versus ls -ld /tmp (shows directory entry). The latter confirms the correct behavior.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
ls -l -d.
Discussion & Comments