hpux support moved
[unix-history] / usr / src / usr.bin / tail / tail.1
CommitLineData
19dad70e
CL
1.\" Copyright (c) 1980, 1990, 1991 Regents of the University of California.
2.\" All rights reserved.
09d34764 3.\"
ae122740
KB
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
19dad70e 7.\" %sccs.include.redist.roff%
09d34764 8.\"
31919d23 9.\" @(#)tail.1 6.9 (Berkeley) %G%
19dad70e
CL
10.\"
11.Dd
12.Dt TAIL 1
13.Os BSD 4
14.Sh NAME
15.Nm tail
0da48e03 16.Nd display the last part of a file
19dad70e
CL
17.Sh SYNOPSIS
18.Nm tail
0da48e03
KB
19.Op Fl f Li | Fl r
20.Oo
21.Fl b Ar number |
22.Fl c Ar number |
23.Fl n Ar number
19dad70e 24.Oc
31919d23 25.Op Ar file ...
19dad70e
CL
26.Sh DESCRIPTION
27The
28.Nm tail
0da48e03
KB
29utility displays the contents of
30.Ar file
31or, by default, its standard input, to the standard output.
32.Pp
ea8ca20d
KB
33The display begins at a byte, line or 512-byte block location in the
34input.
0da48e03 35Numbers having a leading plus (``+'') sign are relative to the beginning
ea8ca20d
KB
36of the input, for example,
37.Dq -c +2
38starts the display at the second
39byte of the input.
0da48e03 40Numbers having a leading minus (``-'') sign or no explicit sign are
ea8ca20d
KB
41relative to the end of the input, for example,
42.Dq -n 2
43displays the last two lines of the input.
44The default starting location is
45.Dq -n 10 ,
46or the last 10 lines of the input.
19dad70e 47.Pp
0da48e03 48The options are as follows:
19dad70e 49.Bl -tag -width Ds
0da48e03 50.It Fl b Ar number
ea8ca20d 51The location is
19dad70e 52.Ar number
0da48e03
KB
53512-byte blocks.
54.It Fl c Ar number
ea8ca20d 55The location is
19dad70e 56.Ar number
0da48e03
KB
57bytes.
58.It Fl f
59The
60.Fl f
61option causes
19dad70e 62.Nm tail
0da48e03
KB
63to not stop when end of file is reached, but rather to wait for additional
64data to be appended to the input.
65The
66.Fl f
31919d23 67option is ignored if the standard input is a pipe, but not if it is a FIFO.
0da48e03 68.It Fl n Ar number
ea8ca20d 69The location is
19dad70e 70.Ar number
0da48e03
KB
71lines.
72.It Fl r
73The
74.Fl r
75option causes the input to be displayed in reverse order, by line.
76Additionally, this option changes the meaning of the
77.Fl b ,
78.Fl c
79and
80.Fl n
81options.
82When the
83.Fl r
84option is specified, these options specify the number of bytes, lines
85or 512-byte blocks to display, instead of the bytes, lines or blocks
86from the beginning or end of the input from which to begin the display.
87The default for the
88.Fl r
89option is to display all of the input.
19dad70e
CL
90.El
91.Pp
31919d23
KB
92If more than a single file is specified, each file is preceded by a
93header consisting of the string
94.Dq ==> XXX <==
95where
96.Dq XXX
97is the name of the file.
98.Pp
19dad70e
CL
99The
100.Nm tail
101utility exits 0 on success, and >0 if an error occurs.
102.Sh SEE ALSO
0da48e03
KB
103.Xr cat 1 ,
104.Xr head 1 ,
105.Xr sed 1
106.Sh STANDARDS
107The
19dad70e 108.Nm tail
0da48e03
KB
109utility is expected to be a superset of the POSIX 1003.2
110specification.
111In particular, the
ea8ca20d
KB
112.Fl b
113and
114.Fl r
115options are extensions to that standard.
116.Pp
117The historic command line syntax of
118.Nm tail
119is supported by this implementation.
120The only difference between this implementation and historic versions
121of
122.Nm tail ,
123once the command line syntax translation has been done, is that the
124.Fl b ,
125.Fl c
126and
127.Fl n
128options modify the
0da48e03 129.Fl r
ea8ca20d
KB
130option, i.e. ``-r -c 4'' displays the last 4 characters of the last line
131of the input, while the historic tail (using the historic syntax ``-4cr'')
132would ignore the
133.Fl c
134option and display the last 4 lines of the input.
19dad70e
CL
135.Sh HISTORY
136A
0da48e03 137.Nm tail
19dad70e
CL
138command appeared in
139.At v7 .