Annotation of src/usr.bin/tail/tail.1, Revision 1.6
1.6 ! aaron 1: .\" $OpenBSD: tail.1,v 1.5 1998/10/30 00:24:38 aaron Exp $
1.1 deraadt 2: .\" $NetBSD: tail.1,v 1.4 1994/11/23 07:42:13 jtc Exp $
3: .\"
4: .\" Copyright (c) 1980, 1990, 1991, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" This code is derived from software contributed to Berkeley by
8: .\" the Institute of Electrical and Electronics Engineers, Inc.
9: .\"
10: .\" Redistribution and use in source and binary forms, with or without
11: .\" modification, are permitted provided that the following conditions
12: .\" are met:
13: .\" 1. Redistributions of source code must retain the above copyright
14: .\" notice, this list of conditions and the following disclaimer.
15: .\" 2. Redistributions in binary form must reproduce the above copyright
16: .\" notice, this list of conditions and the following disclaimer in the
17: .\" documentation and/or other materials provided with the distribution.
18: .\" 3. All advertising materials mentioning features or use of this software
19: .\" must display the following acknowledgement:
20: .\" This product includes software developed by the University of
21: .\" California, Berkeley and its contributors.
22: .\" 4. Neither the name of the University nor the names of its contributors
23: .\" may be used to endorse or promote products derived from this software
24: .\" without specific prior written permission.
25: .\"
26: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36: .\" SUCH DAMAGE.
37: .\"
38: .\" @(#)tail.1 8.1 (Berkeley) 6/6/93
39: .\"
40: .Dd June 6, 1993
41: .Dt TAIL 1
42: .Os BSD 4
43: .Sh NAME
44: .Nm tail
45: .Nd display the last part of a file
46: .Sh SYNOPSIS
1.6 ! aaron 47: .Nm tail
1.1 deraadt 48: .Op Fl f Li | Fl r
49: .Oo
50: .Fl b Ar number |
51: .Fl c Ar number |
52: .Fl n Ar number
53: .Oc
54: .Op Ar file ...
55: .Sh DESCRIPTION
56: The
1.3 millert 57: .Nm
1.1 deraadt 58: utility displays the contents of
59: .Ar file
60: or, by default, its standard input, to the standard output.
61: .Pp
62: The display begins at a byte, line or 512-byte block location in the
63: input.
64: Numbers having a leading plus (``+'') sign are relative to the beginning
65: of the input, for example,
66: .Dq -c +2
67: starts the display at the second
68: byte of the input.
69: Numbers having a leading minus (``-'') sign or no explicit sign are
70: relative to the end of the input, for example,
71: .Dq -n 2
72: displays the last two lines of the input.
73: The default starting location is
74: .Dq -n 10 ,
75: or the last 10 lines of the input.
76: .Pp
77: The options are as follows:
78: .Bl -tag -width Ds
79: .It Fl b Ar number
80: The location is
81: .Ar number
82: 512-byte blocks.
83: .It Fl c Ar number
84: The location is
85: .Ar number
86: bytes.
87: .It Fl f
88: The
89: .Fl f
90: option causes
1.3 millert 91: .Nm
1.5 aaron 92: to not stop when end-of-file is reached, but rather to wait for additional
1.4 aaron 93: data to be appended to the input. If the file is replaced (ie. the
1.3 millert 94: inode number changes),
95: .Nm
96: will reopen the file and continue. If the file is truncated,
97: .Nm
98: will reset its position back to the beginning. This makes
99: .Nm
100: more useful for watching log files that may get rotated.
1.1 deraadt 101: The
102: .Fl f
103: option is ignored if the standard input is a pipe, but not if it is a FIFO.
104: .It Fl n Ar number
105: The location is
106: .Ar number
107: lines.
108: .It Fl r
109: The
110: .Fl r
111: option causes the input to be displayed in reverse order, by line.
112: Additionally, this option changes the meaning of the
113: .Fl b ,
114: .Fl c
115: and
116: .Fl n
117: options.
118: When the
119: .Fl r
120: option is specified, these options specify the number of bytes, lines
121: or 512-byte blocks to display, instead of the bytes, lines or blocks
122: from the beginning or end of the input from which to begin the display.
123: The default for the
124: .Fl r
125: option is to display all of the input.
126: .El
127: .Pp
128: If more than a single file is specified, each file is preceded by a
129: header consisting of the string
130: .Dq ==> XXX <==
131: where
132: .Dq XXX
133: is the name of the file.
134: .Pp
135: The
1.3 millert 136: .Nm
1.5 aaron 137: utility exits 0 on success or >0 if an error occurred.
1.1 deraadt 138: .Sh SEE ALSO
139: .Xr cat 1 ,
140: .Xr head 1 ,
141: .Xr sed 1
142: .Sh STANDARDS
143: The
1.3 millert 144: .Nm
1.1 deraadt 145: utility is expected to be a superset of the
146: .St -p1003.2-92
147: specification.
148: In particular, the
149: .Fl b
150: and
151: .Fl r
152: options are extensions to that standard.
153: .Pp
154: The historic command line syntax of
1.3 millert 155: .Nm
1.1 deraadt 156: is supported by this implementation.
157: The only difference between this implementation and historic versions
158: of
159: .Nm tail ,
160: once the command line syntax translation has been done, is that the
161: .Fl b ,
162: .Fl c
163: and
164: .Fl n
165: options modify the
166: .Fl r
167: option, i.e. ``-r -c 4'' displays the last 4 characters of the last line
168: of the input, while the historic tail (using the historic syntax ``-4cr'')
169: would ignore the
170: .Fl c
171: option and display the last 4 lines of the input.
172: .Sh HISTORY
173: A
1.3 millert 174: .Nm
1.1 deraadt 175: command appeared in
176: .At v7 .