Bird
0
0

What will be the output of ls -l /tmp if /tmp contains two files: file1 and .hidden?

medium📝 Command Output Q4 of 15
Linux CLI - Navigating the File System
What will be the output of ls -l /tmp if /tmp contains two files: file1 and .hidden?
AShows an error because hidden files need -a option
BLists both <code>file1</code> and <code>.hidden</code> with details
CLists only <code>.hidden</code> with details
DLists only <code>file1</code> with details, hidden files excluded
Step-by-Step Solution
Solution:
  1. Step 1: Understand ls -l behavior

    ls -l lists files with details but does not show hidden files unless -a is used.
  2. Step 2: Check which files appear

    Since .hidden is hidden, it won't appear without -a. Only file1 is listed with details.
  3. Final Answer:

    Lists only file1 with details, hidden files excluded -> Option D
  4. Quick Check:

    ls -l excludes hidden files [OK]
Quick Trick: Hidden files need -a to show, else excluded [OK]
Common Mistakes:
  • Assuming hidden files show without -a
  • Thinking -l implies -a
  • Expecting error without -a

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes