Name

tail

Synopsis

                  tail [options] [files]

Print the last 10 lines of each named file (or standard input if - is specified) on standard output. If more than one file is specified, the output includes a header at the beginning of each file:

=  =>filename<=  =

Options

-n[k]

Begin printing at nth item from end-of-file. k specifies the item to count: l (lines, the default), b (blocks), or c (characters).

-k

Same as -n, but use the default count of 10.

+n[k]

Like -n, but start at nth item from beginning of file.

+k

Like -k, but count from beginning of file.

-c num {bkm}, --bytes num {bkm}

Print last num bytes. An alternate blocksize may be specified:

b

512 bytes

k

1 kilobyte

m

1 megabyte

-f, --follow[=name|descriptor]

Don’t quit at the end of file; “follow” file as it grows and end when the user presses Ctrl-c. Following by file descriptor is the default, so -f, --follow, and --follow=descriptor are equivalent. Use --follow=name to track the actual name of a file even if the file is renamed, as with a rotated log file.

-F

Identical to --follow=name --retry.

--help

Print a help message and exit.

-n num, --lines= num

Print the last num lines.

--max-unchanged-stats= num

Used with --follow=name to reopen a file whose size hasn’t changed after num iterations (default 5), to see if it has been unlinked or renamed (as with rotated log files).

--pid= pid

Used with -f to end when process ID pid dies.

-q, --quiet, --silent

Suppress filename headers.

--retry

With -f, keep trying to open a file even if it isn’t ...

Get Linux in a Nutshell, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.