Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux tail command

Show the last lines of a file. Use -f to follow new lines as they arrive.

GNU Coreutils

Syntax

Command form
tail [OPTION]... [FILE]...

Common options

6 options
OptionWhat it does
-n, --lines=NUMPrint the last NUM lines (default 10).
-c, --bytes=NUMPrint the last NUM bytes.
-f, --followKeep reading as the file grows.
-FFollow by name and retry if the file is replaced or recreated.
-q, --quietNever print file headers.
-v, --verboseAlways print file headers.

Usage examples

3 examples

Show the last lines of a file. Use -f to follow new lines as they arrive.

tail -f ./app.log

Show the last 50 lines of a log.

tail -n 50 app.log

Follow a log through rotation or replacement.

tail -F /var/log/app.log

Notes

Stop following with Ctrl+C. File rotation behaviour depends on whether the selected follow mode tracks a descriptor or a name.