That's a great question!
The tail command is the exact opposite of the head command. While head shows the beginning of a file, tail is used to view the end or "tail" of a file.
Here are the key points about tail:
- Default Behavior: Without any options,
taildisplays the last 10 lines of a file. - Specific Lines: Just like
head, you can use the-noption to specify how many lines you want to see. For example:
This would show the last 2 lines of the file.tail -n 2 /tmp/hello - Real-time Monitoring: One of the most powerful uses of
tailis the-f(follow) option. This allows you to watch a file in real-time as new lines are added to the end. This is commonly used by developers to monitor log files:tail -f /var/log/syslog
In short: head for the top, tail for the bottom! Notice a pattern? Many Linux commands work in pairs like this to give you full control over your files.