1 .\" Copyright (c) 1980, 1990, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the Institute of Electrical and Electronics Engineers, Inc.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 4. Neither the name of the University nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" @(#)tail.1 8.1 (Berkeley) 6/6/93
39 .Nd display the last part of a file
45 .Fl b Ar number | Fl c Ar number | Fl n Ar number
51 utility displays the contents of
53 or, by default, its standard input, to the standard output.
55 The display begins at a byte, line or 512-byte block location in the
57 Numbers having a leading plus
59 sign are relative to the beginning
60 of the input, for example,
62 starts the display at the second
64 Numbers having a leading minus
66 sign or no explicit sign are
67 relative to the end of the input, for example,
69 displays the last two lines of the input.
70 The default starting location is
72 or the last 10 lines of the input.
74 The options are as follows:
75 .Bl -tag -width indent
89 to not stop when end of file is reached, but rather to wait for additional
90 data to be appended to the input.
93 option is ignored if the standard input is a pipe, but not if it is a FIFO.
101 will also check to see if the file being followed has been renamed or rotated.
102 The file is closed and reopened when
104 detects that the filename being read from has a new inode number.
106 If the file being followed does not (yet) exist or if it is removed, tail
107 will keep looking and will display the file from the beginning if and when
112 option is the same as the
114 option if reading from standard input rather than a file.
120 Suppresses printing of headers when multiple files are being examined.
124 option causes the input to be displayed in reverse order, by line.
125 Additionally, this option changes the meaning of the
132 option is specified, these options specify the number of bytes, lines
133 or 512-byte blocks to display, instead of the bytes, lines or blocks
134 from the beginning or end of the input from which to begin the display.
137 option is to display all of the input.
140 If more than a single file is specified, each file is preceded by a
141 header consisting of the string
142 .Dq Li "==> " Ns Ar XXX Ns Li " <=="
145 is the name of the file unless
151 To display the last 500 lines of the file
154 .Dl $ tail -n 500 foo
157 .Pa /var/log/messages
158 open, displaying to the standard output anything appended to the file:
160 .Dl $ tail -f /var/log/messages
168 utility is expected to be a superset of the
176 options are extensions to that standard.
178 The historic command line syntax of
180 is supported by this implementation.
181 The only difference between this implementation and historic versions
184 once the command line syntax translation has been done, is that the
193 displays the last 4 characters of the last line
194 of the input, while the historic tail (using the historic syntax
198 option and display the last 4 lines of the input.
202 command appeared in PWB UNIX.