tail -- display the last part of a file


tail [ ±[ number ] [ lbc ] [ -f ] ] [ file ]

tail [ -f ] [ -c number ] [ -n number ] [ file ]


The tail command 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 the point in the file indicated by the -c number or -n number options, where number is a count of bytes (-c) or lines (-n). Both line and byte counts start from 1. If number is prefixed with a plus sign (+), then number is measured from the beginning of the file: if prefixed with a minus sign (-), from the end of the file. No sign causes tail to measure from the end of the file.

With the -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, in which it sleeps for a second and then attempts to read and copy further records from the input file. Thus it may be used to monitor the growth of a file that is being written by some other process. For example, the command tail -f file will print the last ten lines of file, followed by any lines that are appended to file between the time tail is initiated and killed.

In the first syntax line, ±number functions in the same way as the argument to -c and -n. The appended option suffixes cause tail to count as follows:

512 byte blocks


An argument beginning with a minus or plus sign can be used as a single option. The argument ±number specified with the c suffix is the same as -c \(*+-number; with the b suffix it is the same as -c ±number*512; and with either l or no suffix, it is equivalent to -n ± number. If no number is specified, 10 is used as the default. The f suffix is equivalent to specifying the -f option.

tail understands the option -- as the option delimiter.


Tails relative to the end of the file are kept in a buffer, and thus are limited to 20480 characters or approximately 256 lines. Unpredictable results can occur if character special files are ``tailed''.

See also


Standards conformance

tail is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003