xref: /original-bsd/usr.bin/tail/tail.1 (revision e59fb703)
1.\" Copyright (c) 1980, 1990, 1991 Regents of the University of California.
2.\" 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.\" %sccs.include.redist.roff%
8.\"
9.\"	@(#)tail.1	6.7 (Berkeley) 07/21/91
10.\"
11.Dd
12.Dt TAIL 1
13.Os BSD 4
14.Sh NAME
15.Nm tail
16.Nd display the last part of a file
17.Sh SYNOPSIS
18.Nm tail
19.Op Fl f Li | Fl r
20.Oo
21.Fl b Ar number |
22.Fl c Ar number |
23.Fl n Ar number
24.Oc
25.Op Ar file
26.Sh DESCRIPTION
27The
28.Nm tail
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
43input.
44.Pp
45The options are as follows:
46.Bl -tag -width Ds
47.It Fl b Ar number
48The offset is
49.Ar number
50512-byte blocks.
51.It Fl c Ar number
52The offset is
53.Ar number
54bytes.
55.It Fl f
56The
57.Fl f
58option causes
59.Nm tail
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
67.Ar number
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.
87.El
88.Pp
89The
90.Nm tail
91utility exits 0 on success, and >0 if an error occurs.
92.Sh SEE ALSO
93.Xr cat 1 ,
94.Xr head 1 ,
95.Xr sed 1
96.Sh STANDARDS
97The
98.Nm tail
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.
104.Sh HISTORY
105A
106.Nm tail
107command appeared in
108.At v7 .
109