Annotation of src/usr.bin/tail/tail.1, Revision 1.2
1.2 ! deraadt 1: .\" $OpenBSD: tail.1,v 1.4 1994/11/23 07:42:13 jtc 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
47: .Nm tail
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
57: .Nm tail
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
91: .Nm tail
92: to not stop when end of file is reached, but rather to wait for additional
93: data to be appended to the input.
94: The
95: .Fl f
96: option is ignored if the standard input is a pipe, but not if it is a FIFO.
97: .It Fl n Ar number
98: The location is
99: .Ar number
100: lines.
101: .It Fl r
102: The
103: .Fl r
104: option causes the input to be displayed in reverse order, by line.
105: Additionally, this option changes the meaning of the
106: .Fl b ,
107: .Fl c
108: and
109: .Fl n
110: options.
111: When the
112: .Fl r
113: option is specified, these options specify the number of bytes, lines
114: or 512-byte blocks to display, instead of the bytes, lines or blocks
115: from the beginning or end of the input from which to begin the display.
116: The default for the
117: .Fl r
118: option is to display all of the input.
119: .El
120: .Pp
121: If more than a single file is specified, each file is preceded by a
122: header consisting of the string
123: .Dq ==> XXX <==
124: where
125: .Dq XXX
126: is the name of the file.
127: .Pp
128: The
129: .Nm tail
130: utility exits 0 on success, and >0 if an error occurs.
131: .Sh SEE ALSO
132: .Xr cat 1 ,
133: .Xr head 1 ,
134: .Xr sed 1
135: .Sh STANDARDS
136: The
137: .Nm tail
138: utility is expected to be a superset of the
139: .St -p1003.2-92
140: specification.
141: In particular, the
142: .Fl b
143: and
144: .Fl r
145: options are extensions to that standard.
146: .Pp
147: The historic command line syntax of
148: .Nm tail
149: is supported by this implementation.
150: The only difference between this implementation and historic versions
151: of
152: .Nm tail ,
153: once the command line syntax translation has been done, is that the
154: .Fl b ,
155: .Fl c
156: and
157: .Fl n
158: options modify the
159: .Fl r
160: option, i.e. ``-r -c 4'' displays the last 4 characters of the last line
161: of the input, while the historic tail (using the historic syntax ``-4cr'')
162: would ignore the
163: .Fl c
164: option and display the last 4 lines of the input.
165: .Sh HISTORY
166: A
167: .Nm tail
168: command appeared in
169: .At v7 .