tail(1)
NAME
tail − deliver the last part of a file
SYNOPSIS
tail [−b | −c | −l] [−f] [−n number] [file]
Obsolescent:
tail [±[number][lbc[f [file]
DESCRIPTION
tail copies the named file to the standard output beginning at a designated place. If no file is named, the standard input is used.
Copying begins at distance number from the beginning or end of the input; a + preceding number indicates measure from the beginning; a − or no prefix indicates measure from the end of the input. If number is not specified, −10 is assumed. number is counted in units of lines, blocks, or characters, according to additional options. When no units are specified, counting is by lines.
In the obsolescent syntax, the option letters can be concatenated with the number argument. If this syntax is used, ± number must be the first argument given. This version is provided for backward compatibility; the first syntax shown is recommended for portability.
Options
−b The quantity of output is measured in blocks of 512 bytes.
−c The quantity of output is measured in bytes.
−f “follow” option. if the input file is not a pipe, the program will not terminate after the last line of the input file has been copied, but will enter an endless loop, wherein it sleeps for a second and then attempts to read and copy further records from the input file. Thus it can be used to monitor the growth of a file that is being written by some other process. If the input is a pipe ( FIFO ), the −f option is ignored.
−l The quantity of output is measured in lines. This is the default unit of measure.
−n number The number of specified units to output. The number argument is a decimal integer whose sign affects the location in the file to begin the copying. ’+’ means start number units from the beginning of the input; ’-’ or no sign means start number units from the end. The −n number option provides the same functionality as the obsolescent ±number option but in a more standard way.
EXTERNAL INFLUENCES
International Code Set Support
Single-byte character code sets are supported.
EXAMPLES
Print the last three lines in file john to the standard output, and leave tail in “follow” mode:
tail −lf −n 3 john
Print the last 15 characters of file fred followed by any lines that are appended to fred after tail is initiated until it is killed:
tail −n 15 −cf fred
If number is unsigned or ’+’, output begins number units from the beginning of the file (rather than skipping the number of units indicated before starting). For example:
tail −n +1 −b fred
prints the entire contents of file fred.
SEE ALSO
WARNINGS
Tails relative to the end of the file are stored in a 20K-byte buffer, and thus are limited in length. Therefore, be wary of the results when piping output from other commands into tail.
Various kinds of anomalous behavior may occur with character special files.
STANDARDS CONFORMANCE
tail: SVID2, XPG2, XPG3, proposed POSIX.2 FIPS (June 1990)
Hewlett-Packard Company — HP-UX Release 8.05: June 1991