Recall & Review
beginner
What does the command
tail -f filename do?It shows the last lines of the file named
filename and keeps the terminal open to display new lines added to the file in real-time.Click to reveal answer
beginner
Why is
tail -f useful for monitoring logs?Because it lets you watch new log entries as they happen, like watching a live news feed, so you can quickly see updates or errors.
Click to reveal answer
beginner
How can you stop the
tail -f command once it is running?You can stop it by pressing Ctrl + C on your keyboard, which interrupts the command and returns you to the prompt.
Click to reveal answer
beginner
What is the difference between
tail filename and tail -f filename?tail filename shows the last few lines once and exits. tail -f filename shows the last lines and then keeps running to show new lines as they are added.Click to reveal answer
intermediate
Can
tail -f be used on any file?Yes, but it is most useful on files that are actively updated, like log files. For static files, it will just show the last lines and wait without new updates.
Click to reveal answer
What does the
-f option do in the tail command?✗ Incorrect
The -f option makes tail follow the file, showing new lines as they are added.
How do you stop a running
tail -f command?✗ Incorrect
Pressing Ctrl + C sends an interrupt signal to stop the command.
Which file type is
tail -f most useful for?✗ Incorrect
Log files update often, so tail -f helps watch new entries live.
What will
tail -f /var/log/syslog show?✗ Incorrect
This command shows the end of the syslog and updates live as new logs are added.
If you want to see only the last 20 lines of a file once, which command do you use?
✗ Incorrect
tail -n 20 filename shows the last 20 lines once and exits.
Explain how the
tail -f command helps in live log monitoring.Think about watching a live event or news feed.
You got /4 concepts.
Describe how to start and stop live monitoring of a log file using
tail.Starting is with a command, stopping is with a keyboard shortcut.
You got /4 concepts.