xref: /minix3/usr.bin/tail/tail.1 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc.\"	$NetBSD: tail.1,v 1.15 2014/06/15 11:37:56 wiz Exp $
2a967d739SClaudio Martella.\"
3a967d739SClaudio Martella.\" Copyright (c) 1980, 1990, 1991, 1993
4a967d739SClaudio Martella.\"	The Regents of the University of California.  All rights reserved.
5a967d739SClaudio Martella.\"
6a967d739SClaudio Martella.\" This code is derived from software contributed to Berkeley by
7a967d739SClaudio Martella.\" the Institute of Electrical and Electronics Engineers, Inc.
8a967d739SClaudio Martella.\"
9a967d739SClaudio Martella.\" Redistribution and use in source and binary forms, with or without
10a967d739SClaudio Martella.\" modification, are permitted provided that the following conditions
11a967d739SClaudio Martella.\" are met:
12a967d739SClaudio Martella.\" 1. Redistributions of source code must retain the above copyright
13a967d739SClaudio Martella.\"    notice, this list of conditions and the following disclaimer.
14a967d739SClaudio Martella.\" 2. Redistributions in binary form must reproduce the above copyright
15a967d739SClaudio Martella.\"    notice, this list of conditions and the following disclaimer in the
16a967d739SClaudio Martella.\"    documentation and/or other materials provided with the distribution.
17a967d739SClaudio Martella.\" 3. Neither the name of the University nor the names of its contributors
18a967d739SClaudio Martella.\"    may be used to endorse or promote products derived from this software
19a967d739SClaudio Martella.\"    without specific prior written permission.
20a967d739SClaudio Martella.\"
21a967d739SClaudio Martella.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22a967d739SClaudio Martella.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23a967d739SClaudio Martella.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24a967d739SClaudio Martella.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25a967d739SClaudio Martella.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26a967d739SClaudio Martella.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27a967d739SClaudio Martella.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28a967d739SClaudio Martella.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29a967d739SClaudio Martella.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30a967d739SClaudio Martella.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31a967d739SClaudio Martella.\" SUCH DAMAGE.
32a967d739SClaudio Martella.\"
33a967d739SClaudio Martella.\"	@(#)tail.1	8.1 (Berkeley) 6/6/93
34a967d739SClaudio Martella.\"
35*0a6a1f1dSLionel Sambuc.Dd June 15, 2014
36a967d739SClaudio Martella.Dt TAIL 1
37a967d739SClaudio Martella.Os
38a967d739SClaudio Martella.Sh NAME
39a967d739SClaudio Martella.Nm tail
40a967d739SClaudio Martella.Nd display the last part of a file
41a967d739SClaudio Martella.Sh SYNOPSIS
42a967d739SClaudio Martella.Nm
43a967d739SClaudio Martella.Oo
44a967d739SClaudio Martella.Fl f |
45a967d739SClaudio Martella.Fl F |
46a967d739SClaudio Martella.Fl r
47a967d739SClaudio Martella.Oc
48a967d739SClaudio Martella.Oo
49a967d739SClaudio Martella.Fl b Ar number |
50a967d739SClaudio Martella.Fl c Ar number |
51a967d739SClaudio Martella.Fl n Ar number
52a967d739SClaudio Martella.Oc
53a967d739SClaudio Martella.Op Ar file ...
54a967d739SClaudio Martella.Sh DESCRIPTION
55a967d739SClaudio MartellaThe
56a967d739SClaudio Martella.Nm
57a967d739SClaudio Martellautility displays the contents of
58a967d739SClaudio Martella.Ar file
59a967d739SClaudio Martellaor, by default, its standard input, to the standard output.
60a967d739SClaudio Martella.Pp
61a967d739SClaudio MartellaThe display begins at a byte, line or 512-byte block location in the
62a967d739SClaudio Martellainput.
63a967d739SClaudio MartellaNumbers having a leading plus (``+'') sign are relative to the beginning
64a967d739SClaudio Martellaof the input, for example,
65a967d739SClaudio Martella.Dq -c +2
66a967d739SClaudio Martellastarts the display at the second
67a967d739SClaudio Martellabyte of the input.
68a967d739SClaudio MartellaNumbers having a leading minus (``-'') sign or no explicit sign are
69a967d739SClaudio Martellarelative to the end of the input, for example,
70a967d739SClaudio Martella.Dq -n 2
71a967d739SClaudio Martelladisplays the last two lines of the input.
72a967d739SClaudio MartellaThe default starting location is
73a967d739SClaudio Martella.Dq -n 10 ,
74a967d739SClaudio Martellaor the last 10 lines of the input.
75a967d739SClaudio Martella.Pp
76a967d739SClaudio MartellaThe options are as follows:
77a967d739SClaudio Martella.Bl -tag -width Ds
78a967d739SClaudio Martella.It Fl b Ar number
79a967d739SClaudio MartellaThe location is
80a967d739SClaudio Martella.Ar number
81a967d739SClaudio Martella512-byte blocks.
82a967d739SClaudio Martella.It Fl c Ar number
83a967d739SClaudio MartellaThe location is
84a967d739SClaudio Martella.Ar number
85a967d739SClaudio Martellabytes.
86a967d739SClaudio Martella.It Fl f
87a967d739SClaudio MartellaThe
88a967d739SClaudio Martella.Fl f
89a967d739SClaudio Martellaoption causes
90a967d739SClaudio Martella.Nm
91a967d739SClaudio Martellato not stop when end of file is reached, but rather to wait for additional
92a967d739SClaudio Martelladata to be appended to the input.
93a967d739SClaudio MartellaThe
94a967d739SClaudio Martella.Fl f
95*0a6a1f1dSLionel Sambucoption is ignored if there are no file arguments and the standard
96*0a6a1f1dSLionel Sambucinput is a pipe or a FIFO.
97a967d739SClaudio Martella.It Fl F
98a967d739SClaudio MartellaThe
99a967d739SClaudio Martella.Fl F
100a967d739SClaudio Martellaoption is the same as the
101a967d739SClaudio Martella.Fl f
102a967d739SClaudio Martellaoption, except that every five seconds
103a967d739SClaudio Martella.Nm
104a967d739SClaudio Martellawill check to see if the file named on the command line has been
105a967d739SClaudio Martellashortened or moved (it is considered moved if the inode or device
106a967d739SClaudio Martellanumber changes) and, if so, it will close
107a967d739SClaudio Martellathe current file, open the filename given, print out the entire
108a967d739SClaudio Martellacontents, and continue to wait for more data to be appended.
109a967d739SClaudio MartellaThis option is used to follow log files though rotation by
110a967d739SClaudio Martella.Xr newsyslog 8
111a967d739SClaudio Martellaor similar programs.
112a967d739SClaudio Martella.It Fl n Ar number
113a967d739SClaudio MartellaThe location is
114a967d739SClaudio Martella.Ar number
115a967d739SClaudio Martellalines.
116a967d739SClaudio Martella.It Fl r
117a967d739SClaudio MartellaThe
118a967d739SClaudio Martella.Fl r
119a967d739SClaudio Martellaoption causes the input to be displayed in reverse order, by line.
120a967d739SClaudio MartellaAdditionally, this option changes the meaning of the
121a967d739SClaudio Martella.Fl b ,
122a967d739SClaudio Martella.Fl c
123a967d739SClaudio Martellaand
124a967d739SClaudio Martella.Fl n
125a967d739SClaudio Martellaoptions.
126a967d739SClaudio MartellaWhen the
127a967d739SClaudio Martella.Fl r
128a967d739SClaudio Martellaoption is specified, these options specify the number of bytes, lines
129a967d739SClaudio Martellaor 512-byte blocks to display, instead of the bytes, lines or blocks
130a967d739SClaudio Martellafrom the beginning or end of the input from which to begin the display.
131a967d739SClaudio MartellaThe default for the
132a967d739SClaudio Martella.Fl r
133a967d739SClaudio Martellaoption is to display all of the input.
134a967d739SClaudio Martella.El
135a967d739SClaudio Martella.Pp
136a967d739SClaudio MartellaIf more than a single file is specified, each file is preceded by a
137a967d739SClaudio Martellaheader consisting of the string
138a967d739SClaudio Martella.Dq ==\*[Gt] XXX \*[Le]=
139a967d739SClaudio Martellawhere
140a967d739SClaudio Martella.Dq XXX
141a967d739SClaudio Martellais the name of the file.
142a967d739SClaudio Martella.Pp
143a967d739SClaudio MartellaThe
144a967d739SClaudio Martella.Nm
145a967d739SClaudio Martellautility exits 0 on success, and \*[Gt]0 if an error occurs.
146a967d739SClaudio Martella.Sh SEE ALSO
147a967d739SClaudio Martella.Xr cat 1 ,
148a967d739SClaudio Martella.Xr head 1 ,
149a967d739SClaudio Martella.Xr sed 1
150a967d739SClaudio Martella.Sh STANDARDS
151a967d739SClaudio MartellaThe
152a967d739SClaudio Martella.Nm
153a967d739SClaudio Martellautility is expected to be a superset of the
154a967d739SClaudio Martella.St -p1003.2-92
155a967d739SClaudio Martellaspecification.
156a967d739SClaudio MartellaIn particular, the
157a967d739SClaudio Martella.Fl b ,
158a967d739SClaudio Martella.Fl r
159a967d739SClaudio Martellaand
160a967d739SClaudio Martella.Fl F
161a967d739SClaudio Martellaoptions are extensions to that standard.
162a967d739SClaudio Martella.Pp
163a967d739SClaudio MartellaThe historic command line syntax of
164a967d739SClaudio Martella.Nm
165a967d739SClaudio Martellais supported by this implementation.
166a967d739SClaudio MartellaThe only difference between this implementation and historic versions
167a967d739SClaudio Martellaof
168a967d739SClaudio Martella.Nm ,
169a967d739SClaudio Martellaonce the command line syntax translation has been done, is that the
170a967d739SClaudio Martella.Fl b ,
171a967d739SClaudio Martella.Fl c
172a967d739SClaudio Martellaand
173a967d739SClaudio Martella.Fl n
174a967d739SClaudio Martellaoptions modify the
175a967d739SClaudio Martella.Fl r
176a967d739SClaudio Martellaoption, i.e., ``-r -c 4'' displays the last 4 characters of the last line
177a967d739SClaudio Martellaof the input, while the historic tail (using the historic syntax ``-4cr'')
178a967d739SClaudio Martellawould ignore the
179a967d739SClaudio Martella.Fl c
180a967d739SClaudio Martellaoption and display the last 4 lines of the input.
181a967d739SClaudio Martella.Sh HISTORY
182a967d739SClaudio MartellaA
183a967d739SClaudio Martella.Nm
184a967d739SClaudio Martellacommand appeared in
185a967d739SClaudio Martella.At v7 .
186a967d739SClaudio Martella.Sh BUGS
187a967d739SClaudio MartellaWhen using the
188a967d739SClaudio Martella.Fl F
189a967d739SClaudio Martellaoption,
190a967d739SClaudio Martella.Nm
191a967d739SClaudio Martellawill not detect a file truncation if, between the truncation
192a967d739SClaudio Martellaand the next check of the file size, data written to the file make
193a967d739SClaudio Martellait larger than the last known file size.
194