1.\" $NetBSD: tail.1,v 1.4 1994/11/23 07:42:13 jtc Exp $ 2.\" 3.\" Copyright (c) 1980, 1990, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" This code is derived from software contributed to Berkeley by 7.\" the Institute of Electrical and Electronics Engineers, Inc. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the University of 20.\" California, Berkeley and its contributors. 21.\" 4. Neither the name of the University nor the names of its contributors 22.\" may be used to endorse or promote products derived from this software 23.\" without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35.\" SUCH DAMAGE. 36.\" 37.\" @(#)tail.1 8.1 (Berkeley) 6/6/93 38.\" 39.Dd June 6, 1993 40.Dt TAIL 1 41.Os BSD 4 42.Sh NAME 43.Nm tail 44.Nd display the last part of a file 45.Sh SYNOPSIS 46.Nm tail 47.Op Fl f Li | Fl r 48.Oo 49.Fl b Ar number | 50.Fl c Ar number | 51.Fl n Ar number 52.Oc 53.Op Ar file ... 54.Sh DESCRIPTION 55The 56.Nm tail 57utility displays the contents of 58.Ar file 59or, by default, its standard input, to the standard output. 60.Pp 61The display begins at a byte, line or 512-byte block location in the 62input. 63Numbers having a leading plus (``+'') sign are relative to the beginning 64of the input, for example, 65.Dq -c +2 66starts the display at the second 67byte of the input. 68Numbers having a leading minus (``-'') sign or no explicit sign are 69relative to the end of the input, for example, 70.Dq -n 2 71displays the last two lines of the input. 72The default starting location is 73.Dq -n 10 , 74or the last 10 lines of the input. 75.Pp 76The options are as follows: 77.Bl -tag -width Ds 78.It Fl b Ar number 79The location is 80.Ar number 81512-byte blocks. 82.It Fl c Ar number 83The location is 84.Ar number 85bytes. 86.It Fl f 87The 88.Fl f 89option causes 90.Nm tail 91to not stop when end of file is reached, but rather to wait for additional 92data to be appended to the input. 93The 94.Fl f 95option is ignored if the standard input is a pipe, but not if it is a FIFO. 96.It Fl n Ar number 97The location is 98.Ar number 99lines. 100.It Fl r 101The 102.Fl r 103option causes the input to be displayed in reverse order, by line. 104Additionally, this option changes the meaning of the 105.Fl b , 106.Fl c 107and 108.Fl n 109options. 110When the 111.Fl r 112option is specified, these options specify the number of bytes, lines 113or 512-byte blocks to display, instead of the bytes, lines or blocks 114from the beginning or end of the input from which to begin the display. 115The default for the 116.Fl r 117option is to display all of the input. 118.El 119.Pp 120If more than a single file is specified, each file is preceded by a 121header consisting of the string 122.Dq ==> XXX <== 123where 124.Dq XXX 125is the name of the file. 126.Pp 127The 128.Nm tail 129utility exits 0 on success, and >0 if an error occurs. 130.Sh SEE ALSO 131.Xr cat 1 , 132.Xr head 1 , 133.Xr sed 1 134.Sh STANDARDS 135The 136.Nm tail 137utility is expected to be a superset of the 138.St -p1003.2-92 139specification. 140In particular, the 141.Fl b 142and 143.Fl r 144options are extensions to that standard. 145.Pp 146The historic command line syntax of 147.Nm tail 148is supported by this implementation. 149The only difference between this implementation and historic versions 150of 151.Nm tail , 152once the command line syntax translation has been done, is that the 153.Fl b , 154.Fl c 155and 156.Fl n 157options modify the 158.Fl r 159option, i.e. ``-r -c 4'' displays the last 4 characters of the last line 160of the input, while the historic tail (using the historic syntax ``-4cr'') 161would ignore the 162.Fl c 163option and display the last 4 lines of the input. 164.Sh HISTORY 165A 166.Nm tail 167command appeared in 168.At v7 . 169