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.


In the picture above you can see that the last 10 lines of the /tmp/example.txt file were displayed.

The tail command can be used with various options. For example, if you would like to display the last 3 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.

Leave a Reply

Your email address will not be published. Required fields are marked *