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