xref: /freebsd/usr.bin/tail/tail.1 (revision 8fe908ef0cb7aeeb5658acd30b9c9a11b8e33b32)
19b50d902SRodney W. Grimes.\" Copyright (c) 1980, 1990, 1991, 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
49b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
59b50d902SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc.
69b50d902SRodney W. Grimes.\"
79b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
89b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
99b50d902SRodney W. Grimes.\" are met:
109b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
119b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
129b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
139b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
149b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
159b50d902SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
169b50d902SRodney W. Grimes.\"    must display the following acknowledgement:
179b50d902SRodney W. Grimes.\"	This product includes software developed by the University of
189b50d902SRodney W. Grimes.\"	California, Berkeley and its contributors.
199b50d902SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
209b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
219b50d902SRodney W. Grimes.\"    without specific prior written permission.
229b50d902SRodney W. Grimes.\"
239b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
249b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
259b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
269b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
279b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
289b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
299b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
309b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
319b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
329b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
339b50d902SRodney W. Grimes.\" SUCH DAMAGE.
349b50d902SRodney W. Grimes.\"
359b50d902SRodney W. Grimes.\"	@(#)tail.1	8.1 (Berkeley) 6/6/93
36c3aac50fSPeter Wemm.\" $FreeBSD$
379b50d902SRodney W. Grimes.\"
389b50d902SRodney W. Grimes.Dd June 6, 1993
399b50d902SRodney W. Grimes.Dt TAIL 1
409b50d902SRodney W. Grimes.Os BSD 4
419b50d902SRodney W. Grimes.Sh NAME
429b50d902SRodney W. Grimes.Nm tail
439b50d902SRodney W. Grimes.Nd display the last part of a file
449b50d902SRodney W. Grimes.Sh SYNOPSIS
45ea7cc495SPhilippe Charnier.Nm
46eb1c9439SPeter Wemm.Oo
47eb1c9439SPeter Wemm.Fl F |
48eb1c9439SPeter Wemm.Fl f |
49eb1c9439SPeter Wemm.Fl r
50eb1c9439SPeter Wemm.Oc
519b50d902SRodney W. Grimes.Oo
529b50d902SRodney W. Grimes.Fl b Ar number |
539b50d902SRodney W. Grimes.Fl c Ar number |
549b50d902SRodney W. Grimes.Fl n Ar number
559b50d902SRodney W. Grimes.Oc
56ea7cc495SPhilippe Charnier.Op Ar
579b50d902SRodney W. Grimes.Sh DESCRIPTION
589b50d902SRodney W. GrimesThe
59ea7cc495SPhilippe Charnier.Nm
609b50d902SRodney W. Grimesutility displays the contents of
619b50d902SRodney W. Grimes.Ar file
629b50d902SRodney W. Grimesor, by default, its standard input, to the standard output.
639b50d902SRodney W. Grimes.Pp
649b50d902SRodney W. GrimesThe display begins at a byte, line or 512-byte block location in the
659b50d902SRodney W. Grimesinput.
669b50d902SRodney W. GrimesNumbers having a leading plus (``+'') sign are relative to the beginning
679b50d902SRodney W. Grimesof the input, for example,
689b50d902SRodney W. Grimes.Dq -c +2
699b50d902SRodney W. Grimesstarts the display at the second
709b50d902SRodney W. Grimesbyte of the input.
719b50d902SRodney W. GrimesNumbers having a leading minus (``-'') sign or no explicit sign are
729b50d902SRodney W. Grimesrelative to the end of the input, for example,
739b50d902SRodney W. Grimes.Dq -n 2
749b50d902SRodney W. Grimesdisplays the last two lines of the input.
759b50d902SRodney W. GrimesThe default starting location is
769b50d902SRodney W. Grimes.Dq -n 10 ,
779b50d902SRodney W. Grimesor the last 10 lines of the input.
789b50d902SRodney W. Grimes.Pp
799b50d902SRodney W. GrimesThe options are as follows:
809b50d902SRodney W. Grimes.Bl -tag -width Ds
819b50d902SRodney W. Grimes.It Fl b Ar number
829b50d902SRodney W. GrimesThe location is
839b50d902SRodney W. Grimes.Ar number
849b50d902SRodney W. Grimes512-byte blocks.
859b50d902SRodney W. Grimes.It Fl c Ar number
869b50d902SRodney W. GrimesThe location is
879b50d902SRodney W. Grimes.Ar number
889b50d902SRodney W. Grimesbytes.
899b50d902SRodney W. Grimes.It Fl f
909b50d902SRodney W. GrimesThe
919b50d902SRodney W. Grimes.Fl f
929b50d902SRodney W. Grimesoption causes
93ea7cc495SPhilippe Charnier.Nm
949b50d902SRodney W. Grimesto not stop when end of file is reached, but rather to wait for additional
959b50d902SRodney W. Grimesdata to be appended to the input.
969b50d902SRodney W. GrimesThe
979b50d902SRodney W. Grimes.Fl f
989b50d902SRodney W. Grimesoption is ignored if the standard input is a pipe, but not if it is a FIFO.
99eb1c9439SPeter Wemm.It Fl F
100eb1c9439SPeter WemmThe
101eb1c9439SPeter Wemm.Fl F
102eb1c9439SPeter Wemmoption implies the
103eb1c9439SPeter Wemm.Fl f
104eb1c9439SPeter Wemmoption, but
105eb1c9439SPeter Wemm.Nm
106eb1c9439SPeter Wemmwill also check to see if the file being followed has been renamed or rotated.
107eb1c9439SPeter WemmThe file is closed and reopened when
108eb1c9439SPeter Wemm.Nm
109eb1c9439SPeter Wemmdetects that the filename being read from has a new inode number.
110eb1c9439SPeter WemmThe
111eb1c9439SPeter Wemm.Fl F
112eb1c9439SPeter Wemmoption is ignored if reading from standard input rather than a file.
1139b50d902SRodney W. Grimes.It Fl n Ar number
1149b50d902SRodney W. GrimesThe location is
1159b50d902SRodney W. Grimes.Ar number
1169b50d902SRodney W. Grimeslines.
1179b50d902SRodney W. Grimes.It Fl r
1189b50d902SRodney W. GrimesThe
1199b50d902SRodney W. Grimes.Fl r
1209b50d902SRodney W. Grimesoption causes the input to be displayed in reverse order, by line.
1219b50d902SRodney W. GrimesAdditionally, this option changes the meaning of the
1229b50d902SRodney W. Grimes.Fl b ,
1239b50d902SRodney W. Grimes.Fl c
1249b50d902SRodney W. Grimesand
1259b50d902SRodney W. Grimes.Fl n
1269b50d902SRodney W. Grimesoptions.
1279b50d902SRodney W. GrimesWhen the
1289b50d902SRodney W. Grimes.Fl r
1299b50d902SRodney W. Grimesoption is specified, these options specify the number of bytes, lines
1309b50d902SRodney W. Grimesor 512-byte blocks to display, instead of the bytes, lines or blocks
1319b50d902SRodney W. Grimesfrom the beginning or end of the input from which to begin the display.
1329b50d902SRodney W. GrimesThe default for the
1339b50d902SRodney W. Grimes.Fl r
1349b50d902SRodney W. Grimesoption is to display all of the input.
1359b50d902SRodney W. Grimes.El
1369b50d902SRodney W. Grimes.Pp
1379b50d902SRodney W. GrimesIf more than a single file is specified, each file is preceded by a
1389b50d902SRodney W. Grimesheader consisting of the string
1399b50d902SRodney W. Grimes.Dq ==> XXX <==
1409b50d902SRodney W. Grimeswhere
1419b50d902SRodney W. Grimes.Dq XXX
1429b50d902SRodney W. Grimesis the name of the file.
143dbb9d8f8SPhilippe Charnier.Sh DIAGNOSTICS
1449b50d902SRodney W. GrimesThe
145ea7cc495SPhilippe Charnier.Nm
1469b50d902SRodney W. Grimesutility exits 0 on success, and >0 if an error occurs.
1479b50d902SRodney W. Grimes.Sh SEE ALSO
1489b50d902SRodney W. Grimes.Xr cat 1 ,
1499b50d902SRodney W. Grimes.Xr head 1 ,
1509b50d902SRodney W. Grimes.Xr sed 1
1519b50d902SRodney W. Grimes.Sh STANDARDS
1529b50d902SRodney W. GrimesThe
153ea7cc495SPhilippe Charnier.Nm
154ea7cc495SPhilippe Charnierutility is expected to be a superset of the
155ea7cc495SPhilippe Charnier.St -p1003.2-92
1569b50d902SRodney W. Grimesspecification.
1579b50d902SRodney W. GrimesIn particular, the
158eb1c9439SPeter Wemm.Fl F ,
1599b50d902SRodney W. Grimes.Fl b
1609b50d902SRodney W. Grimesand
1619b50d902SRodney W. Grimes.Fl r
1629b50d902SRodney W. Grimesoptions are extensions to that standard.
1639b50d902SRodney W. Grimes.Pp
1649b50d902SRodney W. GrimesThe historic command line syntax of
165ea7cc495SPhilippe Charnier.Nm
1669b50d902SRodney W. Grimesis supported by this implementation.
1679b50d902SRodney W. GrimesThe only difference between this implementation and historic versions
1689b50d902SRodney W. Grimesof
1698fe908efSRuslan Ermilov.Nm ,
1709b50d902SRodney W. Grimesonce the command line syntax translation has been done, is that the
1719b50d902SRodney W. Grimes.Fl b ,
1729b50d902SRodney W. Grimes.Fl c
1739b50d902SRodney W. Grimesand
1749b50d902SRodney W. Grimes.Fl n
1759b50d902SRodney W. Grimesoptions modify the
1769b50d902SRodney W. Grimes.Fl r
1779b50d902SRodney W. Grimesoption, i.e. ``-r -c 4'' displays the last 4 characters of the last line
1789b50d902SRodney W. Grimesof the input, while the historic tail (using the historic syntax ``-4cr'')
1799b50d902SRodney W. Grimeswould ignore the
1809b50d902SRodney W. Grimes.Fl c
1819b50d902SRodney W. Grimesoption and display the last 4 lines of the input.
1829b50d902SRodney W. Grimes.Sh HISTORY
1839b50d902SRodney W. GrimesA
184ea7cc495SPhilippe Charnier.Nm
1859b50d902SRodney W. Grimescommand appeared in
1869b50d902SRodney W. Grimes.At v7 .
187