TAIL(1) | User Commands | TAIL(1) |
tail - deliver the last part of a file
/usr/bin/tail [±s number [lbcr]] [file]
/usr/bin/tail [-lbcr] [file]
/usr/bin/tail [± number [lbcfF]] [file]
/usr/bin/tail [-lbcfF] [file]
/usr/xpg4/bin/tail [-f | -r] [-c number | -n number] [file]
/usr/xpg4/bin/tail [± number [l | b | c] [f]] [file]
/usr/xpg4/bin/tail [± number [l] [f | r]] [file]
The tail utility 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 a point in the file indicated by the -cnumber, -nnumber, or ±number options (if +number is specified, begins at distance number from the beginning; if -number is specified, from the end of the input; if number is NULL, the value 10 is assumed). number is counted in units of lines or byte according to the -c or -n options, or lines, blocks, or bytes, according to the appended option l, b, or c. When no units are specified, counting is by lines.
The following options are supported for both /usr/bin/tail and /usr/xpg4/bin/tail. The -r and -f options are mutually exclusive. If both are specified on the command line, the -f option is ignored.
-b
-c
-f
-F
-l
-r
The following options are supported for /usr/xpg4/bin/tail only:
-c number
+
−
none
The origin for counting is 1; that is, -c+1 represents the first byte of the file, -c−1 the last.
-n number
The following operand is supported:
file
See largefile(7) for the description of the behavior of tail when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
Example 1 Using the tail Command
The following command prints the last ten lines of the file fred, followed by any lines that are appended to fred between the time tail is initiated and killed.
example% tail -f fred
The next command prints the last 15 bytes of the file fred, followed by any lines that are appended to fred between the time tail is initiated and killed:
example% tail -15cf fred
See environ(7) for descriptions of the following environment variables that affect the execution of tail: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
The following exit values are returned:
0
>0
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
CSI | Enabled |
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
CSI | Enabled |
Interface Stability | Standard |
cat(1), head(1), more(1), pg(1), attributes(7), environ(7), largefile(7), standards(7), dd(8)
Piped tails relative to the end of the file are stored in a buffer, and thus are limited in length. Various kinds of anomalous behavior can happen with character special files.
July 13, 2005 | OmniOS |