teach manpages about largefile's demise
[unleashed.git] / share / man / man1 / tail.1
blob42029ffa2f0419d80b5b1863d4330bd44999ff6a
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
45 .\" Portions Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved
46 .\"
47 .TH TAIL 1 "Oct 25, 2017"
48 .SH NAME
49 tail \- deliver the last part of a file
50 .SH SYNOPSIS
51 .LP
52 .nf
53 \fB/usr/bin/tail\fR [\fB-f\fR | \fB-r\fR] [\fB-c\fR \fInumber\fR | \fB-n\fR \fInumber\fR] [\fIfile\fR]
54 .fi
56 .LP
57 .nf
58 \fB/usr/bin/tail\fR [\(+- \fInumber\fR [l | b | c] [f]] [\fIfile\fR]
59 .fi
61 .LP
62 .nf
63 \fB/usr/bin/tail\fR [\(+- \fInumber\fR [l] [f | r]] [\fIfile\fR]
64 .fi
66 .SH DESCRIPTION
67 .sp
68 .LP
69 The \fBtail\fR utility copies the named file to the standard output beginning
70 at a designated place. If no file is named, the standard input is used.
71 .sp
72 .LP
73 Copying begins at a point in the file indicated by the \fB-c\fR\fInumber\fR,
74 \fB-n\fR\fInumber\fR, or \fB\(+-\fR\fInumber\fR options (if \fB+\fR\fInumber\fR
75 is specified, begins at distance number from the beginning; if
76 \fB-\fR\fInumber\fR is specified, from the end of the input; if \fInumber\fR is
77 \fINULL\fR, the value \fB10\fR is assumed). \fInumber\fR is counted in units of
78 lines or byte according to the \fB-c\fR \fB or \fR \fB-n\fR options, or lines,
79 blocks, or bytes, according to the appended option \fBl\fR, \fBb\fR, or
80 \fBc\fR. When no units are specified, counting is by lines.
81 .SH OPTIONS
82 .sp
83 .LP
84 The following options are supported. The \fB-r\fR and \fB-f\fR options are mutually
85 exclusive. If both are specified on the command line, the \fB-f\fR option is
86 ignored.
87 .sp
88 .ne 2
89 .na
90 \fB\fB-b\fR \fR
91 .ad
92 .RS 7n
93 Units of blocks.
94 .RE
96 .sp
97 .ne 2
98 .na
99 \fB\fB-c\fR \fR
101 .RS 7n
102 Units of bytes.
106 .ne 2
108 \fB\fB-f\fR \fR
110 .RS 7n
111 Follow. If the input-file is not a pipe, \fBtail\fR does not terminate after
112 the last line of the input-file has been copied, but enters an endless loop,
113 wherein it watches the file for modifications and attempts to read and copy
114 further records from the input-file. Thus it can be used to monitor the growth
115 of a file that is being written by some other process. If the watched file is
116 truncated \fBtail\fR will begin reading records from the start of the file.
120 .ne 2
122 \fB\fB-F\fR \fR
124 .RS 7n
125 Follow named file. Operates as with \fB-f\fR, except that if the file is moved
126 (e.g. if a watched log file is rotated) \fBtail\fR will close the original file
127 and begin reading records from the start of the file with the specified name
128 if and when that file is recreated.
132 .ne 2
134 \fB\fB-l\fR \fR
136 .RS 7n
137 Units of lines.
141 .ne 2
143 \fB\fB-r\fR \fR
145 .RS 7n
146 Reverse. Copies lines from the specified starting point in the file in reverse
147 order. The default for \fBr\fR is to print the entire file in reverse order.
151 .ne 2
153 \fB\fB-c\fR \fInumber\fR \fR
155 .RS 14n
156 The \fInumber\fR option-argument must be a decimal integer whose sign affects
157 the location in the file, measured in bytes, to begin the copying:
159 .ne 2
161 \fB\fB+\fR \fR
163 .RS 9n
164 Copying starts relative to the beginning of the file.
168 .ne 2
170 \fB\fB\(mi\fR \fR
172 .RS 9n
173 Copying starts relative to the end of the file.
177 .ne 2
179 \fBnone\fR
181 .RS 9n
182 Copying starts relative to the end of the file.
185 The origin for counting is 1; that is, \fB\fR\fB-c\fR\fB+1\fR represents the
186 first byte of the file, \fB\fR\fB-c\fR\fB\(mi1\fR the last.
190 .ne 2
192 \fB\fB-n\fR \fInumber\fR \fR
194 .RS 14n
195 Equivalent to \fB-c\fR\fInumber,\fR except the starting location in the file is
196 measured in lines instead of bytes. The origin for counting is \fB1\fR. That
197 is, \fB-n\fR\fB+1\fR represents the first line of the file, \fB-n\fR\fB\(mi1\fR
198 the last.
201 .SH OPERANDS
204 The following operand is supported:
206 .ne 2
208 \fB\fIfile\fR \fR
210 .RS 9n
211 A path name of an input file. If no \fIfile\fR operands are specified, the
212 standard input is used.
215 .SH EXAMPLES
217 \fBExample 1 \fRUsing the tail Command
220 The following command prints the last ten lines of the file \fBfred\fR,
221 followed by any lines that are appended to \fBfred\fR between the time
222 \fBtail\fR is initiated and killed.
225 .in +2
227 example% \fBtail -f fred\fR
229 .in -2
234 The next command prints the last 15 bytes of the file \fBfred\fR, followed by
235 any lines that are appended to \fBfred\fR between the time \fBtail\fR is
236 initiated and killed:
239 .in +2
241 example% \fBtail -15cf fred\fR
243 .in -2
246 .SH ENVIRONMENT VARIABLES
249 See \fBenviron\fR(5) for descriptions of the following environment variables
250 that affect the execution of \fBtail\fR: \fBLANG\fR, \fBLC_ALL\fR,
251 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
252 .SH EXIT STATUS
255 The following exit values are returned:
257 .ne 2
259 \fB\fB0\fR \fR
261 .RS 7n
262 Successful completion.
266 .ne 2
268 \fB\fB>0\fR \fR
270 .RS 7n
271 An error occurred.
274 .SH ATTRIBUTES
277 See \fBattributes\fR(5) for descriptions of the following attributes:
278 .SS "/usr/bin/tail"
283 box;
284 c | c
285 l | l .
286 ATTRIBUTE TYPE  ATTRIBUTE VALUE
288 CSI     Enabled
290 Interface Stability     Standard
293 .SH SEE ALSO
296 \fBcat\fR(1), \fBhead\fR(1), \fBmore\fR(1), \fBpg\fR(1), \fBdd\fR(8),
297 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
298 .SH NOTES
301 Piped tails relative to the end of the file are stored in a buffer, and thus
302 are limited in length. Various kinds of anomalous behavior can happen with
303 character special files.