tail command - Prints the End of the File

You can use the tail command to print the end of the file. Use this when you want to check only the end of the file.

tail FileName

The tail command is fast because it doesn't read the entire file.

Tail command sample

This is a sample tail command that displays the end of foo.txt.

tail foo.txt

Specify the number of lines to display at the end

You can specify the number of lines to display at the end by specifying the number of lines after the hyphen. The following example displays the last 20 lines.

tail -20 filename

Continue to output the end of the file

Use the "-f" option to continue printing the end of the file if the file has been updated.

tail -f foo.txt

Associated Information