Recall & Review
beginner
What is the purpose of the /var/log directory in Linux?
The /var/log directory stores system log files. These logs record events, errors, and messages from the system and applications to help monitor and troubleshoot.
Click to reveal answer
beginner
Which command shows the last 10 lines of a log file?
The
tail command shows the last 10 lines by default. For example, tail /var/log/syslog shows the last 10 lines of the syslog file.Click to reveal answer
beginner
How can you continuously watch new entries added to a log file?
Use
tail -f /var/log/filename. This command shows new lines as they are added, like watching a live feed.Click to reveal answer
intermediate
What is the difference between /var/log/syslog and /var/log/auth.log?
/var/log/syslog records general system messages and events. /var/log/auth.log records authentication-related events like logins and sudo usage.
Click to reveal answer
beginner
Why is it important to check system logs regularly?
Checking logs helps find problems early, understand system behavior, and improve security by spotting unauthorized access or errors.
Click to reveal answer
Which command shows the last 20 lines of /var/log/syslog?
✗ Incorrect
tail -n 20 shows the last 20 lines of the file. head shows the first lines, cat | less shows the whole file page by page, and grep 20 searches for the text '20'.
What does the command
tail -f /var/log/auth.log do?✗ Incorrect
tail -f shows the end of the file and keeps showing new lines as they appear, useful for live monitoring.
Which log file would you check to find failed login attempts?
✗ Incorrect
/var/log/auth.log records authentication events including failed logins.
What is the main reason to use system logs?
✗ Incorrect
System logs help track what happens on the system and find issues.
Which command would you use to search for the word 'error' in /var/log/syslog?
✗ Incorrect
grep searches for text patterns in files. Here it finds lines containing 'error'.
Explain how you would monitor a system log file in real time to catch new events as they happen.
Think about a command that shows the end of a file and keeps updating.
You got /3 concepts.
Describe the difference between /var/log/syslog and /var/log/auth.log and when you would check each.
One is for overall system events, the other for security-related events.
You got /3 concepts.