xref: /dragonfly/usr.bin/tail/tail.1 (revision f746689a)
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. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed by the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"	@(#)tail.1	8.1 (Berkeley) 6/6/93
36.\" $FreeBSD: src/usr.bin/tail/tail.1,v 1.5.2.4 2002/07/15 07:46:27 keramida Exp $
37.\" $DragonFly: src/usr.bin/tail/tail.1,v 1.3 2007/07/30 22:11:33 swildner Exp $
38.\"
39.Dd June 6, 1993
40.Dt TAIL 1
41.Os
42.Sh NAME
43.Nm tail
44.Nd display the last part of a file
45.Sh SYNOPSIS
46.Nm
47.Oo
48.Fl F |
49.Fl f |
50.Fl r
51.Oc
52.Oo
53.Fl b Ar number |
54.Fl c Ar number |
55.Fl n Ar number
56.Oc
57.Op Ar
58.Sh DESCRIPTION
59The
60.Nm
61utility displays the contents of
62.Ar file
63or, by default, its standard input, to the standard output.
64.Pp
65The display begins at a byte, line or 512-byte block location in the
66input.
67Numbers having a leading plus (``+'') sign are relative to the beginning
68of the input, for example,
69.Dq -c +2
70starts the display at the second
71byte of the input.
72Numbers having a leading minus (``-'') sign or no explicit sign are
73relative to the end of the input, for example,
74.Dq -n 2
75displays the last two lines of the input.
76The default starting location is
77.Dq -n 10 ,
78or the last 10 lines of the input.
79.Pp
80The options are as follows:
81.Bl -tag -width Ds
82.It Fl b Ar number
83The location is
84.Ar number
85512-byte blocks.
86.It Fl c Ar number
87The location is
88.Ar number
89bytes.
90.It Fl f
91The
92.Fl f
93option causes
94.Nm
95to not stop when end of file is reached, but rather to wait for additional
96data to be appended to the input.
97The
98.Fl f
99option is ignored if the standard input is a pipe, but not if it is a FIFO.
100.It Fl F
101The
102.Fl F
103option implies the
104.Fl f
105option, but
106.Nm
107will also check to see if the file being followed has been renamed or rotated.
108The file is closed and reopened when
109.Nm
110detects that the filename being read from has a new inode number.
111The
112.Fl F
113option is ignored if reading from standard input rather than a file.
114.It Fl n Ar number
115The location is
116.Ar number
117lines.
118.It Fl r
119The
120.Fl r
121option causes the input to be displayed in reverse order, by line.
122Additionally, this option changes the meaning of the
123.Fl b ,
124.Fl c
125and
126.Fl n
127options.
128When the
129.Fl r
130option is specified, these options specify the number of bytes, lines
131or 512-byte blocks to display, instead of the bytes, lines or blocks
132from the beginning or end of the input from which to begin the display.
133The default for the
134.Fl r
135option is to display all of the input.
136.El
137.Pp
138If more than a single file is specified, each file is preceded by a
139header consisting of the string
140.Dq ==> XXX <==
141where
142.Dq XXX
143is the name of the file.
144.Sh EXIT STATUS
145.Ex -std
146.Sh SEE ALSO
147.Xr cat 1 ,
148.Xr head 1 ,
149.Xr sed 1
150.Sh STANDARDS
151The
152.Nm
153utility is expected to be a superset of the
154.St -p1003.2-92
155specification.
156In particular, the
157.Fl F ,
158.Fl b
159and
160.Fl r
161options are extensions to that standard.
162.Pp
163The historic command line syntax of
164.Nm
165is supported by this implementation.
166The only difference between this implementation and historic versions
167of
168.Nm ,
169once the command line syntax translation has been done, is that the
170.Fl b ,
171.Fl c
172and
173.Fl n
174options modify the
175.Fl r
176option, i.e. ``-r -c 4'' displays the last 4 characters of the last line
177of the input, while the historic tail (using the historic syntax ``-4cr'')
178would ignore the
179.Fl c
180option and display the last 4 lines of the input.
181.Sh HISTORY
182A
183.Nm
184command appeared in PWB
185.Ux .
186