Tail (Unix)

From Freepedia

The title of this article is shown beginning with a capital letter due to technical restrictions. The correct title is {{{title|{{{1}}}}}}.

tail is a program on Unix and Unix-like systems used to display the last few lines of a text file or piped data. The command-syntax is:

tail [options] <file_name>

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, 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

External links



Views
Personal tools
In other languages
Similar Links