Display the last part of a file with tail

0

Similar to the head command which shows you the first few lines of a text file, the tail command lets you to quickly view the last few lines of a text file. It also supports a monitoring mode which displays ongoing changes within the file.

The tail command syntax.

By default tail will show you the last 10 lines of a text file.

You can change the number of lines displayed by adding ‘-n‘ option and adding the number of lines.

This will show the last 3 lines in the file.

You can keep track of ongoing changes within the file by turning on monitoring mode with the ‘-f‘ option. It is especially helpful when you want to keep an eye on log files.

As lines are appended to the log file they are also displayed by tail.

You can exit the program by pressing Ctrl-C.

Share.