Annotation of src/usr.bin/tail/tail.1, Revision 1.9
1.9 ! aaron 1: .\" $OpenBSD: tail.1,v 1.8 2000/01/22 02:17:49 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
1.7 aaron 42: .Os
1.1 deraadt 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.
1.9 ! aaron 64: Numbers having a leading plus
! 65: .Pq Ql +
! 66: sign are relative to the beginning of the input, for example,
! 67: .Ic -c +2
1.1 deraadt 68: starts the display at the second
69: byte of the input.
1.9 ! aaron 70: Numbers having a leading minus
! 71: .Pq Ql -
! 72: sign or no explicit sign are
1.1 deraadt 73: relative to the end of the input, for example,
1.9 ! aaron 74: .Ic -n 2
1.1 deraadt 75: displays the last two lines of the input.
76: The default starting location is
1.9 ! aaron 77: .Ic -n 10 ,
1.1 deraadt 78: or the last 10 lines of the input.
79: .Pp
80: The options are as follows:
81: .Bl -tag -width Ds
82: .It Fl b Ar number
83: The location is
84: .Ar number
85: 512-byte blocks.
86: .It Fl c Ar number
87: The location is
88: .Ar number
89: bytes.
90: .It Fl f
91: The
92: .Fl f
93: option causes
1.3 millert 94: .Nm
1.5 aaron 95: to not stop when end-of-file is reached, but rather to wait for additional
1.9 ! aaron 96: data to be appended to the input.
! 97: If the file is replaced (i.e., the inode number changes),
1.3 millert 98: .Nm
1.9 ! aaron 99: will reopen the file and continue.
! 100: If the file is truncated,
1.3 millert 101: .Nm
1.9 ! aaron 102: will reset its position back to the beginning.
! 103: This makes
1.3 millert 104: .Nm
105: more useful for watching log files that may get rotated.
1.1 deraadt 106: The
107: .Fl f
108: option is ignored if the standard input is a pipe, but not if it is a FIFO.
109: .It Fl n Ar number
110: The location is
111: .Ar number
112: lines.
113: .It Fl r
114: The
115: .Fl r
116: option causes the input to be displayed in reverse order, by line.
117: Additionally, this option changes the meaning of the
118: .Fl b ,
119: .Fl c
120: and
121: .Fl n
122: options.
123: When the
124: .Fl r
125: option is specified, these options specify the number of bytes, lines
126: or 512-byte blocks to display, instead of the bytes, lines or blocks
127: from the beginning or end of the input from which to begin the display.
128: The default for the
129: .Fl r
130: option is to display all of the input.
131: .El
132: .Pp
133: If more than a single file is specified, each file is preceded by a
134: header consisting of the string
135: .Dq ==> XXX <==
136: where
137: .Dq XXX
138: is the name of the file.
139: .Pp
140: The
1.3 millert 141: .Nm
1.5 aaron 142: utility exits 0 on success or >0 if an error occurred.
1.1 deraadt 143: .Sh SEE ALSO
144: .Xr cat 1 ,
145: .Xr head 1 ,
146: .Xr sed 1
147: .Sh STANDARDS
148: The
1.3 millert 149: .Nm
1.7 aaron 150: utility is expected to be a superset of the
151: .St -p1003.2-92
1.1 deraadt 152: specification.
153: In particular, the
154: .Fl b
155: and
156: .Fl r
157: options are extensions to that standard.
158: .Pp
159: The historic command line syntax of
1.3 millert 160: .Nm
1.1 deraadt 161: is supported by this implementation.
162: The only difference between this implementation and historic versions
163: of
164: .Nm tail ,
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
1.9 ! aaron 172: option, i.e.,
! 173: .Ic -r -c 4
! 174: displays the last 4 characters of the last line
! 175: of the input, while the historic tail (using the historic syntax
! 176: .Ic -4cr )
1.1 deraadt 177: would ignore the
178: .Fl c
179: option and display the last 4 lines of the input.
180: .Sh HISTORY
181: A
1.3 millert 182: .Nm
1.1 deraadt 183: command appeared in
184: .At v7 .