Name
tail
Synopsis
tail [options
] [file
]
Print the last 10 lines of the named
file. Use only one of -f
or
-r
.
The GNU/Linux and Mac OS X versions can process multiple files. In that case, the output includes a header at the beginning of each file:
= =>filename
<= =
Historic Options
The syntaxes shown here are the historic usage. Currently
all systems continue to accept them, but the -c
and -n
options are preferred.
-
n
[
k
]Begin printing at n th item from end of file. k specifies the item to count:
l
(lines, the default),b
(blocks), orc
(characters, i.e., bytes).-
-
k
Same as previous, but use the default count of 10.
+
n
[
k
]Like
-
n, but start at n th item from beginning of file.-
+
k
Like
-
k, but count from beginning of file.
Common Options
-c
count
,--bytes=
count
With a leading
+
on count, start count bytes from the front of the file. With a leading-
or no sign, start from the end of the file.-f
[
follow_spec
],--follow
[=
follow_spec
]Don’t quit at the end of file; “follow” file as it grows. End with an INTR (usually
^C
).Only GNU/Linux allows a follow_spec. If the follow_spec is
descriptor
, tail follows the open file descriptor. This shows the original file, even if it is renamed or removed, and is the command’s original, default behavior. If follow_spec isname
, then tail periodically reopens the file by name. This is useful in cases where filenames change, such as rotated log files.-n
count
,--lines=
count
With a leading
+
on count, start count lines from the front of the file. With a leading
Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.