new version from scratch; POSIX 1003.2 version
[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.\"
0da48e03 9.\" @(#)tail.1 6.7 (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
CL
24.Oc
25.Op Ar file
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
33The display begins at an offset from either the beginning or end
34of the input.
35Offsets may be specified in terms of bytes, lines or 512-byte blocks.
36Numbers having a leading plus (``+'') sign are relative to the beginning
37of the input.
38Numbers having a leading minus (``-'') sign or no explicit sign are
39relative to the end of the input.
40All offsets are 1 based, i.e. ``-c +1'' skips a single byte of the
41input.
42The default offset is ``-n 10'', or 10 lines from the end of the
19dad70e
CL
43input.
44.Pp
0da48e03 45The options are as follows:
19dad70e 46.Bl -tag -width Ds
0da48e03
KB
47.It Fl b Ar number
48The offset is
19dad70e 49.Ar number
0da48e03
KB
50512-byte blocks.
51.It Fl c Ar number
52The offset is
19dad70e 53.Ar number
0da48e03
KB
54bytes.
55.It Fl f
56The
57.Fl f
58option causes
19dad70e 59.Nm tail
0da48e03
KB
60to not stop when end of file is reached, but rather to wait for additional
61data to be appended to the input.
62The
63.Fl f
64option is ignored on pipes but not on FIFO's.
65.It Fl n Ar number
66The offset is
19dad70e 67.Ar number
0da48e03
KB
68lines.
69.It Fl r
70The
71.Fl r
72option causes the input to be displayed in reverse order, by line.
73Additionally, this option changes the meaning of the
74.Fl b ,
75.Fl c
76and
77.Fl n
78options.
79When the
80.Fl r
81option is specified, these options specify the number of bytes, lines
82or 512-byte blocks to display, instead of the bytes, lines or blocks
83from the beginning or end of the input from which to begin the display.
84The default for the
85.Fl r
86option is to display all of the input.
19dad70e
CL
87.El
88.Pp
89The
90.Nm tail
91utility exits 0 on success, and >0 if an error occurs.
92.Sh SEE ALSO
0da48e03
KB
93.Xr cat 1 ,
94.Xr head 1 ,
95.Xr sed 1
96.Sh STANDARDS
97The
19dad70e 98.Nm tail
0da48e03
KB
99utility is expected to be a superset of the POSIX 1003.2
100specification.
101In particular, the
102.Fl r
103option is an extension to that standard.
19dad70e
CL
104.Sh HISTORY
105A
0da48e03 106.Nm tail
19dad70e
CL
107command appeared in
108.At v7 .