Bird
0
0

What will be the output of the command ls -l secret.txt if the file has permissions -rw------- and you are logged in as a different user?

medium📝 Command Output Q13 of 15
Linux CLI - File Permissions and Ownership
What will be the output of the command ls -l secret.txt if the file has permissions -rw------- and you are logged in as a different user?
AYou will get a 'Permission denied' error when trying to read the file.
BYou will see the file details but cannot read the file.
CYou will see the file details and can read the file.
DThe file will not appear in the directory listing.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze file permissions

    -rw------- means only owner has read/write, others have no permissions.
  2. Step 2: Understand ls -l behavior

    ls -l displays file metadata (permissions, owner, size) without needing read permission on the file; assumes directory allows access.
  3. Final Answer:

    You will see the file details but cannot read the file. -> Option B
  4. Quick Check:

    ls -l shows details, read denied [OK]
Quick Trick: ls -l shows details despite no read permission [OK]
Common Mistakes:
  • Thinking file won't show in listing
  • Assuming read access is allowed
  • Confusing file details visibility with read permission

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes