Tail (Unix) |
tail is a Computer program on Unix and Unix-like systems used to display the last few lines of a text Computer file or pipe (computing)d data. The command-syntax is:
tail [options]
By default, tail will print the last 10 lines of its input to the standard output. With command line options the number of lines printed and the printing units (lines, blocks or bytes) may be changed. The following example shows the last 20 lines of filename :
tail -20 filename
This displays the last 15 bytes of all files starting with foo :
tail -15c foo*
=File monitoring=
tail has a special command line option -f (follow) that allows a file to be monitored. Instead of displaying the last few lines and exiting, tail displays the lines and then monitors the file. As new lines are added to the file by another Process#Computing, tail updates the display. This is particularly useful for monitoring log files. The following command will display the last 10 lines of messages and append new lines to the display as new lines are added to messages :
tail -f /var/adm/messages
To interrupt tail while it is monitoring, break-in with CTRL-C.
=See also=
*head (Unix)
= External links =
|
|