tail

NAME

tail - display the last part of a file

SYNOPSIS

tail [-c number | -n number | -k number | -m number] 
	 [-f | -r][file]

tail -[number][b|c|l][f] [file]

tail +[number][b|c|l][f] [file]

DESCRIPTION

The tail(1) utility displays the contents of file or, by default, its standard input, to the standard output.

The display begins at a byte, line or 512-byte block location in the input. Numbers having a leading plus (+) sign are relative to the beginning of the input; for example, tail -c +2 or tail +2cstarts the display at the second byte of the input. Numbers having a leading minus (-) sign or, when used with -c or -n, no explicit sign are relative to the end of the input; for example, tail -n 2 or tail -2 displays the last two lines of the input. The default starting location is -10, or the last 10 lines of the input.

The options are as follows:

-f
The -f option causes tail(1) to not stop when end of file is reached, but rather to wait for additional data to be appended to the input. The -f option is ignored if the standard input is a pipe, but not if it is a first-in-first-out (FIFO).
-r
Display the input in reverse order, by line. Additionally, this option changes the meaning of the -b, -c and -n options. When the -r option is specified, these options specify the number of bytes, lines or 512-byte blocks to display, instead of the bytes, lines or blocks from the beginning or end of the input from which to begin the display. The default for the -r option is to display all of the input.
-c number
The location is number bytes.
-n number
The location is number lines.
-k number
Display the last number kilobytes (1024 bytes) of the file.
-m number
Display the last number megabytes (1,048,576 bytes) of the file.
+[number] [b | c | l][f] [file]
– [number] [b | c | l][f] [file]
The interpretation of number depends on which letter, if any, follow number: b indicates 512-byte blocks; c indicates bytes, and l indicates lines. Adding f causes tail(1) to not stop when end of file is reached, but rather to wait for additional data to be appended to the input. The f option is ignored if the standard input is a pipe, but not if it is a first-in-first-out (FIFO).

The -l number option, which is found in some implementations of UNIX, is not standard and is not supported. Instead, use the -n number option, which has the same functionality.

If more than a single file is specified, each file is preceded by a header consisting of the string ==> filename <== where filename is the name of the file.

DIAGNOSTICS

The tail(1) utility exits 0 on success, and >0 if an error occurs.

SEE ALSO

cat(1)

head(1)

sed(1)