Display last lines of a text file
The tail command displays, by default, the last 10 lines of a text file in Linux. This command can be very useful when examining recent activity in log files.
Here is an example:
In the picture above you can see that the last 10 lines of the /var/log/messages file were displayed.
The tail command can be used with various options. For example, if you would like to display the last 5 lines of a file, you can use the -n option:
Another option that you will find handy is the -f option. This option keeps the file open and displays new lines as they are being added to the file.