Name

tail [options] [files] — coreutils

Synopsis

/usr/bin stdin stdout - file -- opt --help --version

The tail command prints the last 10 lines of a file, and does other tricks as well.

$ tail myfile

Useful options

-N

Print the last N lines of the file instead of 10.

-n N

 

+N

Print all lines except the first N.

-c N

Print the last N bytes of the file.

-f

Keep the file open, and whenever lines are appended to the file, print them. This is extremely useful. Add the --retry option if the file doesn’t exist yet, but you want to wait for it to exist.

-q

Quiet mode: when processing more than one file, don’t print a banner above each file. Normally tail prints a banner containing the filename.

Get Linux Pocket Guide 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.