Bird
0
0

You want to monitor two log files live at the same time: /var/log/nginx/access.log and /var/log/nginx/error.log. Which command will correctly do this?

hard📝 Best Practice Q15 of 15
Linux CLI - Viewing and Editing Files
You want to monitor two log files live at the same time: /var/log/nginx/access.log and /var/log/nginx/error.log. Which command will correctly do this?
Atail -f /var/log/nginx/access.log /var/log/nginx/error.log
Btail -f /var/log/nginx/access.log && tail -f /var/log/nginx/error.log
Ctail -f /var/log/nginx/access.log | tail -f /var/log/nginx/error.log
Dtail -f /var/log/nginx/access.log; tail -f /var/log/nginx/error.log
Step-by-Step Solution
Solution:
  1. Step 1: Understand how to monitor multiple files

    tail -f accepts multiple filenames to follow them simultaneously in one terminal.
  2. Step 2: Analyze each option

    tail -f /var/log/nginx/access.log /var/log/nginx/error.log correctly lists both files after tail -f. Using && or ; runs commands sequentially, so the second starts after the first ends. Piping two tail -f commands with | is invalid for this purpose.
  3. Final Answer:

    tail -f /var/log/nginx/access.log /var/log/nginx/error.log -> Option A
  4. Quick Check:

    Multiple files = list all after tail -f [OK]
Quick Trick: List all files after tail -f to watch together [OK]
Common Mistakes:
  • Using && or ; runs commands one after another, not together
  • Piping two tail -f commands is invalid
  • Trying to monitor files separately in one terminal

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes