tail

v0.0.28
tail [FLAG]... [FILE]...

Print the last 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read standard input.

Mandatory arguments to long flags are mandatory for short flags too.

Options

--bytes, -c

Number of bytes to print

--follow, -f

Print the file as it grows

--lines, -n

Number of lines to print

--pid=<PID>

With -f, terminate after process ID, PID dies

--quiet, --silent, -q

Never output headers giving file names

--sleep-interval=<N>, -s <N>

Number of seconds to sleep between polling the file when running with -f

--max-unchanged-stats=<N>

Reopen a FILE which has not changed size after N (default 5) iterations to see if it has been unlinked or renamed (this is the usual case of rotated log files); This option is meaningful only when polling (i.e., with --use-polling) and when --follow=name

--verbose, -v

Always output headers giving file names

--zero-terminated, -z

Line delimiter is NUL, not newline

--use-polling

Disable 'inotify' support and use polling instead

--retry

Keep trying to open a file if it is inaccessible

-F

Same as --follow=name --retry

--presume-input-pipe

Examples

Show last 'count' lines in file:

tail --lines {{count}} {{path/to/file}}

Print a file from a specific line number:

tail --lines +{{count}} {{path/to/file}}

Print a specific count of bytes from the end of a given file:

tail --bytes {{count}} {{path/to/file}}

Print the last lines of a given file and keep reading it until Ctrl + C:

tail --follow {{path/to/file}}

Keep reading file until Ctrl + C, even if the file is inaccessible:

tail --retry --follow {{path/to/file}}

Show last 'num' lines in 'file' and refresh every 'n' seconds:

tail --lines {{count}} --sleep-interval {{seconds}} --follow {{path/to/file}}

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.