Bird
0
0

You try to run tail -f /var/log/app.log but get the error: tail: cannot open '/var/log/app.log' for reading: Permission denied. What should you do to fix this?

medium📝 Troubleshoot Q14 of 15
Linux CLI - Viewing and Editing Files
You try to run tail -f /var/log/app.log but get the error: tail: cannot open '/var/log/app.log' for reading: Permission denied. What should you do to fix this?
ADelete the log file and try again
BRun the command with <code>sudo</code> to get permission
CUse <code>head -f</code> instead
DRestart the system to fix permissions
Step-by-Step Solution
Solution:
  1. Step 1: Understand the error message

    The error says permission denied, meaning the current user cannot read the file.
  2. Step 2: Fix permission issue

    Running the command with sudo gives temporary admin rights to read the file.
  3. Final Answer:

    Run the command with sudo to get permission -> Option B
  4. Quick Check:

    Permission denied fix = use sudo [OK]
Quick Trick: Permission denied? Try sudo before the command [OK]
Common Mistakes:
MISTAKES
  • Deleting the log file unnecessarily
  • Using head -f which is invalid
  • Restarting system without checking permissions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes