Report issue Add example

tail

Output the last part of files

Description

The tail command is used to output the last part of a file.

Syntax

tail (options) (parameters)

Options

-c, --bytes=NUM                 Output the last NUM bytes.
-f, --follow[={name|descriptor}] Output appended data as the file grows. "name" tracks by filename.
-F                              Same as "--follow=name --retry".
-n, --lines=NUM                 Output the last NUM lines.
--pid=PID                       Used with "-f"; terminate after process PID dies.
-q, --quiet, --silent           Never output headers giving file names.
--retry                         Keep trying to open a file if it is inaccessible. Use with "--follow=name".
-s, --sleep-interval=N          With "-f", sleep for N seconds between iterations.
-v, --verbose                   Always output headers giving file names.
--help                          Display help information.
--version                       Display version information.

Parameters

File list: List of files to display the end of.

Examples

tail file # (Display the last 10 lines of file)
tail -n +20 file # (Display file from line 20 to the end)
tail -c 10 file # (Display the last 10 bytes of file)

tail -25 mail.log # Display the last 25 lines of mail.log
tail -f mail.log # Equivalent to --follow=descriptor; tracking stops if the file is renamed or deleted.
tail -F mail.log # Equivalent to --follow=name --retry; tracking continues even if the file is deleted or renamed if a new file with the same name is created.