Bird
0
0

You want to monitor the last 15 lines of a growing log file app.log in real-time but only want to see the newest lines as they appear. Which command combination is best?

hard📝 Application Q15 of 15
Linux CLI - Viewing and Editing Files
You want to monitor the last 15 lines of a growing log file app.log in real-time but only want to see the newest lines as they appear. Which command combination is best?
A<code>head -n 15 app.log</code>
B<code>tail -n 15 app.log</code>
C<code>tail -n 15 -f app.log</code>
D<code>head -n 15 -f app.log</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand the need to see last lines and follow updates

    You want the last 15 lines and to watch new lines as they are added.
  2. Step 2: Use tail with -n 15 and -f

    tail -n 15 -f app.log shows last 15 lines and follows file changes live.
  3. Final Answer:

    tail -n 15 -f app.log -> Option C
  4. Quick Check:

    tail -n 15 -f = last 15 lines + live updates [OK]
Quick Trick: Use tail -f to follow file changes live [OK]
Common Mistakes:
  • Using head which shows start, not end
  • Omitting -f to follow updates
  • Using head -f which is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes