Annotation of src/usr.bin/tail/tail.1, Revision 1.23
1.23 ! zhuk 1: .\" $OpenBSD: tail.1,v 1.22 2015/09/15 19:15:32 schwarze 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.
1.11 millert 18: .\" 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 19: .\" may be used to endorse or promote products derived from this software
20: .\" without specific prior written permission.
21: .\"
22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: .\" SUCH DAMAGE.
33: .\"
34: .\" @(#)tail.1 8.1 (Berkeley) 6/6/93
35: .\"
1.23 ! zhuk 36: .Dd $Mdocdate: September 15 2015 $
1.1 deraadt 37: .Dt TAIL 1
1.7 aaron 38: .Os
1.1 deraadt 39: .Sh NAME
40: .Nm tail
41: .Nd display the last part of a file
42: .Sh SYNOPSIS
1.6 aaron 43: .Nm tail
1.14 jmc 44: .Op Fl f | r
1.1 deraadt 45: .Oo
46: .Fl b Ar number |
47: .Fl c Ar number |
1.10 aaron 48: .Fl n Ar number |
1.22 schwarze 49: .Fl Ar number
1.1 deraadt 50: .Oc
1.14 jmc 51: .Op Ar
1.1 deraadt 52: .Sh DESCRIPTION
53: The
1.3 millert 54: .Nm
1.1 deraadt 55: utility displays the contents of
56: .Ar file
57: or, by default, its standard input, to the standard output.
58: .Pp
1.10 aaron 59: The display begins at a byte, line, or 512-byte block location in the
1.1 deraadt 60: input.
1.9 aaron 61: Numbers having a leading plus
62: .Pq Ql +
63: sign are relative to the beginning of the input, for example,
64: .Ic -c +2
1.1 deraadt 65: starts the display at the second
66: byte of the input.
1.9 aaron 67: Numbers having a leading minus
68: .Pq Ql -
69: sign or no explicit sign are
1.1 deraadt 70: relative to the end of the input, for example,
1.9 aaron 71: .Ic -n 2
1.1 deraadt 72: displays the last two lines of the input.
73: The default starting location is
1.9 aaron 74: .Ic -n 10 ,
1.1 deraadt 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
1.12 jmc 88: Do not stop when end-of-file is reached; instead, wait for additional
1.9 aaron 89: data to be appended to the input.
90: If the file is replaced (i.e., the inode number changes),
1.3 millert 91: .Nm
1.9 aaron 92: will reopen the file and continue.
93: If the file is truncated,
1.3 millert 94: .Nm
1.10 aaron 95: will reset its position to the beginning.
1.9 aaron 96: This makes
1.3 millert 97: .Nm
98: more useful for watching log files that may get rotated.
1.1 deraadt 99: The
100: .Fl f
1.20 guenther 101: option is ignored if there are no
102: .Fa file
103: arguments and the standard input is a pipe or a FIFO.
1.22 schwarze 104: .It Fl n Ar number | Fl Ar number
1.14 jmc 105: The location is
106: .Ar number
107: lines.
1.1 deraadt 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 ,
1.10 aaron 114: .Fl c ,
1.1 deraadt 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
1.10 aaron 121: or 512-byte blocks to display, instead of the bytes, lines, or blocks
1.1 deraadt 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
1.23 ! zhuk 128: If more than one file is specified,
! 129: .Nm
! 130: precedes the output of each file with the following, in order
! 131: to distinguish files:
! 132: .Pp
! 133: .Dl ==> Ar file No <==
1.18 jmc 134: .Sh EXIT STATUS
1.13 jmc 135: .Ex -std tail
1.10 aaron 136: .Sh EXAMPLES
137: To display the last 500 lines of the file
138: .Ar foo :
139: .Pp
140: .Dl $ tail -500 foo
141: .Pp
142: Keep
143: .Pa /var/log/messages
144: open, displaying to the standard output anything appended to the file:
145: .Pp
146: .Dl $ tail -f /var/log/messages
1.1 deraadt 147: .Sh SEE ALSO
148: .Xr cat 1 ,
149: .Xr head 1 ,
150: .Xr sed 1
151: .Sh STANDARDS
152: The
1.3 millert 153: .Nm
1.15 jmc 154: utility is compliant with the
1.17 jmc 155: .St -p1003.1-2008
1.20 guenther 156: specification.
1.15 jmc 157: .Pp
158: The flags
159: .Op Fl br
160: are extensions to that specification.
1.1 deraadt 161: .Pp
162: The historic command line syntax of
1.3 millert 163: .Nm
1.1 deraadt 164: is supported by this implementation.
165: The only difference between this implementation and historic versions
166: of
167: .Nm tail ,
168: once the command line syntax translation has been done, is that the
169: .Fl b ,
170: .Fl c
171: and
172: .Fl n
173: options modify the
174: .Fl r
1.9 aaron 175: option, i.e.,
176: .Ic -r -c 4
177: displays the last 4 characters of the last line
178: of the input, while the historic tail (using the historic syntax
179: .Ic -4cr )
1.1 deraadt 180: would ignore the
181: .Fl c
182: option and display the last 4 lines of the input.
183: .Sh HISTORY
184: A
1.3 millert 185: .Nm
1.1 deraadt 186: command appeared in
187: .At v7 .