Linux Commands | File Management | tail Print File Contents from the Bottom

tail Command

The tail command prints file contents from the last line. By default, it prints the last 10 lines.

Syntax

tail (options) [file path/name to view]

Option

  • -1: Enter the number of lines you want to display.

tail Command Examples

Example 1

Print the last 5 lines of /etc/passwd.

tail -5 /etc/passwd

Example 2

Print the last 10 lines of /etc/passwd and display line numbers on the left.

tail /etc/passwd | cat -n