Linux command: tail

A quick guide to the tail command to monitor changes in files

I think the best use of tail is with-fOptions. It will open the file at the end and monitor file changes. Whenever there is new content in the file, it will be printed in the window. This is great for viewing log files, for example:

tail -f /var/log/system.log

To exit, pressctrl-C.

You can print the last 10 lines in the file:

tail -n 10 <filename>

You can use the following command to print the entire file content starting from a specific line:+Before the line number:

tail -n +10 <filename>

tailMore things can be done, as always, my suggestion is to checkman tail.

This command can be used in Linux, macOS, WSL and wherever you have a UNIX environment

Download mine for freeLinux Command Manual


More cli tutorials: