tail

From Mac Guides

Jump to: navigation, search

tail is a Terminal command used to show the last few lines of a file. It's normally used to monitor log files.

Examples

To show the last 10 lines of the system log

 tail /var/log/system.log

To show the last 10 lines of the system log, along with any new lines that get added:

 tail -f /var/log/system.log

To show the last 20 lines of the system log:

 tail -20 /var/log/system.log

Man Page Excerpt

The tail utility displays the contents of file or, by default, its stan- dard input, to the standard output. The display begins at a byte, line or 512-byte block location in the input. Numbers having a leading plus (``+) sign are relative to the beginning of the input, for example, ``-c +2 starts the display at the second byte of the input. Numbers having a leading minus (``-) sign or no explicit sign are relative to the end of the input, for example, ``-n 2 displays the last two lines of the input. The default starting loca- tion is ``-n 10, or the last 10 lines of the input.

See Also