summaryrefslogtreecommitdiffstats
path: root/man1p/tail.1p
diff options
context:
space:
mode:
Diffstat (limited to 'man1p/tail.1p')
-rw-r--r--man1p/tail.1p249
1 files changed, 249 insertions, 0 deletions
diff --git a/man1p/tail.1p b/man1p/tail.1p
new file mode 100644
index 000000000..515d18ea9
--- /dev/null
+++ b/man1p/tail.1p
@@ -0,0 +1,249 @@
+.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
+.TH "TAIL" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
+.\" tail
+.SH NAME
+tail \- copy the last part of a file
+.SH SYNOPSIS
+.LP
+\fBtail\fP \fB[\fP\fB-f\fP\fB][\fP \fB-c\fP \fInumber\fP\fB| -n\fP
+\fInumber\fP\fB][\fP\fIfile\fP\fB]\fP
+.SH DESCRIPTION
+.LP
+The \fItail\fP utility shall copy its input file to the standard output
+beginning at a designated place.
+.LP
+Copying shall begin at the point in the file indicated by the \fB-c\fP
+\fInumber\fP or \fB-n\fP \fInumber\fP options. The
+option-argument \fInumber\fP shall be counted in units of lines or
+bytes, according to the options \fB-n\fP and \fB-c\fP. Both
+line and byte counts start from 1.
+.LP
+Tails relative to the end of the file may be saved in an internal
+buffer, and thus may be limited in length. Such a buffer, if
+any, shall be no smaller than {LINE_MAX}*10 bytes.
+.SH OPTIONS
+.LP
+The \fItail\fP utility shall conform to the Base Definitions volume
+of IEEE\ Std\ 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
+.LP
+The following options shall be supported:
+.TP 7
+\fB-c\ \fP \fInumber\fP
+The application shall ensure that the \fInumber\fP option-argument
+is a decimal integer whose sign affects the location in the
+file, measured in bytes, to begin the copying:
+.TS C
+center; l l.
+\fBSign\fP \fBCopying Starts\fP
++ Relative to the beginning of the file.
+- Relative to the end of the file.
+\fInone\fP Relative to the end of the file.
+.TE
+.LP
+The origin for counting shall be 1; that is, \fB-c\fP +1 represents
+the first byte of the file, \fB-c\fP -1 the last.
+.TP 7
+\fB-f\fP
+If the input file is a regular file or if the \fIfile\fP operand specifies
+a FIFO, do not terminate after the last line of the
+input file has been copied, but read and copy further bytes from the
+input file when they become available. If no \fIfile\fP
+operand is specified and standard input is a pipe, the \fB-f\fP option
+shall be ignored. If the input file is not a FIFO, pipe, or
+regular file, it is unspecified whether or not the \fB-f\fP option
+shall be ignored.
+.TP 7
+\fB-n\ \fP \fInumber\fP
+This option shall be equivalent to \fB-c\fP \fInumber\fP, except the
+starting location in the file shall be measured in lines
+instead of bytes. The origin for counting shall be 1; that is, \fB-n\fP
++1 represents the first line of the file, \fB-n\fP -1 the
+last.
+.sp
+.LP
+If neither \fB-c\fP nor \fB-n\fP is specified, \fB-n\fP 10 shall be
+assumed.
+.SH OPERANDS
+.LP
+The following operand shall be supported:
+.TP 7
+\fIfile\fP
+A pathname of an input file. If no \fIfile\fP operands are specified,
+the standard input shall be used.
+.sp
+.SH STDIN
+.LP
+The standard input shall be used only if no \fIfile\fP operands are
+specified. See the INPUT FILES section.
+.SH INPUT FILES
+.LP
+If the \fB-c\fP option is specified, the input file can contain arbitrary
+data; otherwise, the input file shall be a text
+file.
+.SH ENVIRONMENT VARIABLES
+.LP
+The following environment variables shall affect the execution of
+\fItail\fP:
+.TP 7
+\fILANG\fP
+Provide a default value for the internationalization variables that
+are unset or null. (See the Base Definitions volume of
+IEEE\ Std\ 1003.1-2001, Section 8.2, Internationalization Variables
+for
+the precedence of internationalization variables used to determine
+the values of locale categories.)
+.TP 7
+\fILC_ALL\fP
+If set to a non-empty string value, override the values of all the
+other internationalization variables.
+.TP 7
+\fILC_CTYPE\fP
+Determine the locale for the interpretation of sequences of bytes
+of text data as characters (for example, single-byte as
+opposed to multi-byte characters in arguments and input files).
+.TP 7
+\fILC_MESSAGES\fP
+Determine the locale that should be used to affect the format and
+contents of diagnostic messages written to standard
+error.
+.TP 7
+\fINLSPATH\fP
+Determine the location of message catalogs for the processing of \fILC_MESSAGES
+\&.\fP
+.sp
+.SH ASYNCHRONOUS EVENTS
+.LP
+Default.
+.SH STDOUT
+.LP
+The designated portion of the input file shall be written to standard
+output.
+.SH STDERR
+.LP
+The standard error shall be used only for diagnostic messages.
+.SH OUTPUT FILES
+.LP
+None.
+.SH EXTENDED DESCRIPTION
+.LP
+None.
+.SH EXIT STATUS
+.LP
+The following exit values shall be returned:
+.TP 7
+\ 0
+Successful completion.
+.TP 7
+>0
+An error occurred.
+.sp
+.SH CONSEQUENCES OF ERRORS
+.LP
+Default.
+.LP
+\fIThe following sections are informative.\fP
+.SH APPLICATION USAGE
+.LP
+The \fB-c\fP option should be used with caution when the input is
+a text file containing multi-byte characters; it may produce
+output that does not start on a character boundary.
+.LP
+Although the input file to \fItail\fP can be any type, the results
+might not be what would be expected on some character
+special device files or on file types not described by the System
+Interfaces volume of IEEE\ Std\ 1003.1-2001. Since this
+volume of IEEE\ Std\ 1003.1-2001 does not specify the block size used
+when doing input, \fItail\fP need not read all of
+the data from devices that only perform block transfers.
+.SH EXAMPLES
+.LP
+The \fB-f\fP option can be used to monitor the growth of a file that
+is being written by some other process. For example, the
+command:
+.sp
+.RS
+.nf
+
+\fBtail -f fred
+\fP
+.fi
+.RE
+.LP
+prints the last ten lines of the file \fBfred\fP, followed by any
+lines that are appended to \fBfred\fP between the time
+\fItail\fP is initiated and killed. As another example, the command:
+.sp
+.RS
+.nf
+
+\fBtail -f -c 15 fred
+\fP
+.fi
+.RE
+.LP
+prints the last 15 bytes of the file \fBfred\fP, followed by any bytes
+that are appended to \fBfred\fP between the time
+\fItail\fP is initiated and killed.
+.SH RATIONALE
+.LP
+This version of \fItail\fP was created to allow conformance to the
+Utility Syntax Guidelines. The historical \fB-b\fP option
+was omitted because of the general non-portability of block-sized
+units of text. The \fB-c\fP option historically meant
+"characters", but this volume of IEEE\ Std\ 1003.1-2001 indicates
+that it means "bytes". This was selected to allow
+reasonable implementations when multi-byte characters are possible;
+it was not named \fB-b\fP to avoid confusion with the
+historical \fB-b\fP.
+.LP
+The origin of counting both lines and bytes is 1, matching all widespread
+historical implementations.
+.LP
+The restriction on the internal buffer is a compromise between the
+historical System V implementation of 4096 bytes and the BSD
+32768 bytes.
+.LP
+The \fB-f\fP option has been implemented as a loop that sleeps for
+1 second and copies any bytes that are available. This is
+sufficient, but if more efficient methods of determining when new
+data are available are developed, implementations are encouraged
+to use them.
+.LP
+Historical documentation indicates that \fItail\fP ignores the \fB-f\fP
+option if the input file is a pipe (pipe and FIFO on
+systems that support FIFOs). On BSD-based systems, this has been true;
+on System V-based systems, this was true when input was
+taken from standard input, but it did not ignore the \fB-f\fP flag
+if a FIFO was named as the \fIfile\fP operand. Since the
+\fB-f\fP option is not useful on pipes and all historical implementations
+ignore \fB-f\fP if no \fIfile\fP operand is specified
+and standard input is a pipe, this volume of IEEE\ Std\ 1003.1-2001
+requires this behavior. However, since the \fB-f\fP
+option is useful on a FIFO, this volume of IEEE\ Std\ 1003.1-2001
+also requires that if standard input is a FIFO or a FIFO
+is named, the \fB-f\fP option shall not be ignored. Although historical
+behavior does not ignore the \fB-f\fP option for other
+file types, this is unspecified so that implementations are allowed
+to ignore the \fB-f\fP option if it is known that the file
+cannot be extended.
+.LP
+This was changed to the current form based on comments noting that
+\fB-c\fP was almost never used without specifying a number
+and that there was no need to specify \fB-l\fP if \fB-n\fP \fInumber\fP
+was given.
+.SH FUTURE DIRECTIONS
+.LP
+None.
+.SH SEE ALSO
+.LP
+\fIhead\fP
+.SH COPYRIGHT
+Portions of this text are reprinted and reproduced in electronic form
+from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
+-- Portable Operating System Interface (POSIX), The Open Group Base
+Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
+Electrical and Electronics Engineers, Inc and The Open Group. In the
+event of any discrepancy between this version and the original IEEE and
+The Open Group Standard, the original IEEE and The Open Group Standard
+is the referee document. The original Standard can be obtained online at
+http://www.opengroup.org/unix/online.html .