Tail ( / usr / bin / tail ), ( engl. "tail ", " end " ) is one of the many text filter in Unix and Unix-like operating systems and is used to display the last lines of a file. Its counterpart is head, indicating the first lines of a file.
The functions and the behavior tails is defined by the POSIX standard.
The behavior and syntax of tail similar to those of many other command-line programs. It expects either a filename or an input data stream to stdin and provides its output to stdout, error messages are written to stderr. Expenditure can be redirected by conventional means ( Redirection, pipeline).
Tail [ options] [
Tail- c 100 / path / to / input # are all from the 100th byte counted from the beginning of the file, from tail- n -100 / path / to / input # are all from the 100th line, calculated from the end of file, from tail- n 100 / path / to / input # same as above, ie the last 100 lines The default is tail of the last 10 lines of a file.
Obsolete syntax variants
Most implementations (eg, AIX, HP- Ux ) understand beyond even a - now no longer recommended for use - syntax, which does not require the-n option:
Tail -20 / path / to / input # the last 20 lines of a file tail- 50c / path / to / input # the last 50 bytes of a file This syntax does not match the POSIX standard and should therefore be avoided. It can not be assumed that this syntax is the same yet supported on a system or a future version.
With the switch -f (follow) the output will be continuously updated as long as the program to the SIGINT signal is sent (for example, the key combination Ctrl C). This function makes tail suitable (eg logs) as a live monitor for constantly-changing files.
The following example displays the last 15 lines of the log of an HACMP cluster ( / usr / es / adm / cluster.log ) and continuously adds new items:
Tail- f n 15 / usr / es / adm / cluster.log Web Links
- Tail (1) - Debian GNU / Linux Executable programs or shell commands manual page