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