1 .\" $NetBSD: tail.1,v 1.12 2003/02/25 10:35:56 wiz Exp $
3 .\" Copyright (c) 1980, 1990, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" the Institute of Electrical and Electronics Engineers, Inc.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)tail.1 8.1 (Berkeley) 6/6/93
40 .Nd display the last part of a file
57 utility displays the contents of
59 or, by default, its standard input, to the standard output.
61 The display begins at a byte, line or 512-byte block location in the
63 Numbers having a leading plus (``+'') sign are relative to the beginning
64 of the input, for example,
66 starts the display at the second
68 Numbers having a leading minus (``-'') sign or no explicit sign are
69 relative to the end of the input, for example,
71 displays the last two lines of the input.
72 The default starting location is
74 or the last 10 lines of the input.
76 The options are as follows:
91 to not stop when end of file is reached, but rather to wait for additional
92 data to be appended to the input.
95 option is ignored if the standard input is a pipe, but not if it is a FIFO.
99 option is the same as the
101 option, except that every five seconds
103 will check to see if the file named on the command line has been
104 shortened or moved (it is considered moved if the inode or device
105 number changes) and, if so, it will close
106 the current file, open the filename given, print out the entire
107 contents, and continue to wait for more data to be appended.
108 This option is used to follow log files though rotation by
118 option causes the input to be displayed in reverse order, by line.
119 Additionally, this option changes the meaning of the
127 option is specified, these options specify the number of bytes, lines
128 or 512-byte blocks to display, instead of the bytes, lines or blocks
129 from the beginning or end of the input from which to begin the display.
132 option is to display all of the input.
135 If more than a single file is specified, each file is preceded by a
136 header consisting of the string
137 .Dq ==\*[Gt] XXX \*[Le]=
140 is the name of the file.
144 utility exits 0 on success, and \*[Gt]0 if an error occurs.
152 utility is expected to be a superset of the
160 options are extensions to that standard.
162 The historic command line syntax of
164 is supported by this implementation.
165 The only difference between this implementation and historic versions
168 once the command line syntax translation has been done, is that the
175 option, i.e. ``-r -c 4'' displays the last 4 characters of the last line
176 of the input, while the historic tail (using the historic syntax ``-4cr'')
179 option and display the last 4 lines of the input.
190 will not detect a file truncation if, between the truncation
191 and the next check of the file size, data written to the file make
192 it larger than the last known file size.