]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - usr.bin/tail/tail.1
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / usr.bin / tail / tail.1
1 .\" Copyright (c) 1980, 1990, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the Institute of Electrical and Electronics Engineers, Inc.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
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 .\" 3. All advertising materials mentioning features or use of this software
16 .\"    must display the following acknowledgement:
17 .\"     This product includes software developed by the University of
18 .\"     California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\"    may be used to endorse or promote products derived from this software
21 .\"    without specific prior written permission.
22 .\"
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" SUCH DAMAGE.
34 .\"
35 .\"     @(#)tail.1      8.1 (Berkeley) 6/6/93
36 .\" $FreeBSD$
37 .\"
38 .Dd June 05, 2009
39 .Dt TAIL 1
40 .Os
41 .Sh NAME
42 .Nm tail
43 .Nd display the last part of a file
44 .Sh SYNOPSIS
45 .Nm
46 .Op Fl F | f | r
47 .Op Fl q
48 .Oo
49 .Fl b Ar number | Fl c Ar number | Fl n Ar number
50 .Oc
51 .Op Ar
52 .Sh DESCRIPTION
53 The
54 .Nm
55 utility displays the contents of
56 .Ar file
57 or, by default, its standard input, to the standard output.
58 .Pp
59 The display begins at a byte, line or 512-byte block location in the
60 input.
61 Numbers having a leading plus
62 .Pq Ql +
63 sign are relative to the beginning
64 of the input, for example,
65 .Dq Li "-c +2"
66 starts the display at the second
67 byte of the input.
68 Numbers having a leading minus
69 .Pq Ql -
70 sign or no explicit sign are
71 relative to the end of the input, for example,
72 .Dq Li "-n 2"
73 displays the last two lines of the input.
74 The default starting location is
75 .Dq Li "-n 10" ,
76 or the last 10 lines of the input.
77 .Pp
78 The options are as follows:
79 .Bl -tag -width indent
80 .It Fl b Ar number
81 The location is
82 .Ar number
83 512-byte blocks.
84 .It Fl c Ar number
85 The location is
86 .Ar number
87 bytes.
88 .It Fl f
89 The
90 .Fl f
91 option causes
92 .Nm
93 to not stop when end of file is reached, but rather to wait for additional
94 data to be appended to the input.
95 The
96 .Fl f
97 option is ignored if the standard input is a pipe, but not if it is a FIFO.
98 .It Fl F
99 The
100 .Fl F
101 option implies the
102 .Fl f
103 option, but
104 .Nm
105 will also check to see if the file being followed has been renamed or rotated.
106 The file is closed and reopened when
107 .Nm
108 detects that the filename being read from has a new inode number.
109 .Pp
110 If the file being followed does not (yet) exist or if it is removed, tail
111 will keep looking and will display the file from the beginning if and when
112 it is created.
113 .Pp
114 The
115 .Fl F
116 option is the same as the
117 .Fl f
118 option if reading from standard input rather than a file.
119 .It Fl n Ar number
120 The location is
121 .Ar number
122 lines.
123 .It Fl q
124 Suppresses printing of headers when multiple files are being examined.
125 .It Fl r
126 The
127 .Fl r
128 option causes the input to be displayed in reverse order, by line.
129 Additionally, this option changes the meaning of the
130 .Fl b , c
131 and
132 .Fl n
133 options.
134 When the
135 .Fl r
136 option is specified, these options specify the number of bytes, lines
137 or 512-byte blocks to display, instead of the bytes, lines or blocks
138 from the beginning or end of the input from which to begin the display.
139 The default for the
140 .Fl r
141 option is to display all of the input.
142 .El
143 .Pp
144 If more than a single file is specified, each file is preceded by a
145 header consisting of the string
146 .Dq Li "==> " Ns Ar XXX Ns Li " <=="
147 where
148 .Ar XXX
149 is the name of the file unless
150 .Fl q
151 flag is specified.
152 .Sh EXIT STATUS
153 .Ex -std
154 .Sh SEE ALSO
155 .Xr cat 1 ,
156 .Xr head 1 ,
157 .Xr sed 1
158 .Sh STANDARDS
159 The
160 .Nm
161 utility is expected to be a superset of the
162 .St -p1003.2-92
163 specification.
164 In particular, the
165 .Fl F ,
166 .Fl b
167 and
168 .Fl r
169 options are extensions to that standard.
170 .Pp
171 The historic command line syntax of
172 .Nm
173 is supported by this implementation.
174 The only difference between this implementation and historic versions
175 of
176 .Nm ,
177 once the command line syntax translation has been done, is that the
178 .Fl b ,
179 .Fl c
180 and
181 .Fl n
182 options modify the
183 .Fl r
184 option, i.e.,
185 .Dq Li "-r -c 4"
186 displays the last 4 characters of the last line
187 of the input, while the historic tail (using the historic syntax
188 .Dq Li -4cr )
189 would ignore the
190 .Fl c
191 option and display the last 4 lines of the input.
192 .Sh HISTORY
193 A
194 .Nm
195 command appeared in PWB UNIX.