Merge branch 'vendor/FILE'
[dragonfly.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. 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.
18 .\"
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
29 .\" SUCH DAMAGE.
30 .\"
31 .\"     @(#)tail.1      8.1 (Berkeley) 6/6/93
32 .\" $FreeBSD: src/usr.bin/tail/tail.1,v 1.5.2.4 2002/07/15 07:46:27 keramida Exp $
33 .\" $DragonFly: src/usr.bin/tail/tail.1,v 1.3 2007/07/30 22:11:33 swildner Exp $
34 .\"
35 .Dd June 6, 1993
36 .Dt TAIL 1
37 .Os
38 .Sh NAME
39 .Nm tail
40 .Nd display the last part of a file
41 .Sh SYNOPSIS
42 .Nm
43 .Oo
44 .Fl F |
45 .Fl f |
46 .Fl r
47 .Oc
48 .Oo
49 .Fl b Ar number |
50 .Fl c Ar number |
51 .Fl n Ar number
52 .Oc
53 .Op Ar
54 .Sh DESCRIPTION
55 The
56 .Nm
57 utility displays the contents of
58 .Ar file
59 or, by default, its standard input, to the standard output.
60 .Pp
61 The display begins at a byte, line or 512-byte block location in the
62 input.
63 Numbers having a leading plus (``+'') sign are relative to the beginning
64 of the input, for example,
65 .Dq -c +2
66 starts the display at the second
67 byte of the input.
68 Numbers having a leading minus (``-'') sign or no explicit sign are
69 relative to the end of the input, for example,
70 .Dq -n 2
71 displays the last two lines of the input.
72 The default starting location is
73 .Dq -n 10 ,
74 or the last 10 lines of the input.
75 .Pp
76 The options are as follows:
77 .Bl -tag -width Ds
78 .It Fl b Ar number
79 The location is
80 .Ar number
81 512-byte blocks.
82 .It Fl c Ar number
83 The location is
84 .Ar number
85 bytes.
86 .It Fl f
87 The
88 .Fl f
89 option causes
90 .Nm
91 to not stop when end of file is reached, but rather to wait for additional
92 data to be appended to the input.
93 The
94 .Fl f
95 option is ignored if the standard input is a pipe, but not if it is a FIFO.
96 .It Fl F
97 The
98 .Fl F
99 option implies the
100 .Fl f
101 option, but
102 .Nm
103 will also check to see if the file being followed has been renamed or rotated.
104 The file is closed and reopened when
105 .Nm
106 detects that the filename being read from has a new inode number.
107 The
108 .Fl F
109 option is ignored if reading from standard input rather than a file.
110 .It Fl n Ar number
111 The location is
112 .Ar number
113 lines.
114 .It Fl r
115 The
116 .Fl r
117 option causes the input to be displayed in reverse order, by line.
118 Additionally, this option changes the meaning of the
119 .Fl b ,
120 .Fl c
121 and
122 .Fl n
123 options.
124 When the
125 .Fl r
126 option is specified, these options specify the number of bytes, lines
127 or 512-byte blocks to display, instead of the bytes, lines or blocks
128 from the beginning or end of the input from which to begin the display.
129 The default for the
130 .Fl r
131 option is to display all of the input.
132 .El
133 .Pp
134 If more than a single file is specified, each file is preceded by a
135 header consisting of the string
136 .Dq ==> XXX <==
137 where
138 .Dq XXX
139 is the name of the file.
140 .Sh EXIT STATUS
141 .Ex -std
142 .Sh SEE ALSO
143 .Xr cat 1 ,
144 .Xr head 1 ,
145 .Xr sed 1
146 .Sh STANDARDS
147 The
148 .Nm
149 utility is expected to be a superset of the
150 .St -p1003.2-92
151 specification.
152 In particular, the
153 .Fl F ,
154 .Fl b
155 and
156 .Fl r
157 options are extensions to that standard.
158 .Pp
159 The historic command line syntax of
160 .Nm
161 is supported by this implementation.
162 The only difference between this implementation and historic versions
163 of
164 .Nm ,
165 once the command line syntax translation has been done, is that the
166 .Fl b ,
167 .Fl c
168 and
169 .Fl n
170 options modify the
171 .Fl r
172 option, i.e. ``-r -c 4'' displays the last 4 characters of the last line
173 of the input, while the historic tail (using the historic syntax ``-4cr'')
174 would ignore the
175 .Fl c
176 option and display the last 4 lines of the input.
177 .Sh HISTORY
178 A
179 .Nm
180 command appeared in PWB
181 .Ux .