Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > T

tail(1)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

tail — deliver the last part of a file

SYNOPSIS

tail [-f] [-b number] [file]

tail [-f] [-c number] [file]

tail [-f] [-n number] [file]

Obsolescent:

tail [±[number]][l|b |c] [-f] [file]

DESCRIPTION

tail copies the named file to the standard output beginning at a designated place. If no file is named, standard input is used.

Command Forms

tail can be used in three forms as indicated above:

tail -b number...

Copy file starting at number blocks from end or beginning of file.

tail -c number...

Copy file starting at number bytes from end or beginning of file.

tail -n number...

tail number...

Copy file starting at number lines from end or beginning of file.

tail with no options specified is equivalent to tail -n 10....

Options and Command-Line Arguments

tail recognizes the following options and command-line arguments:

-f

Follow option. If the input file is a regular file or if file 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 (tail enters an endless loop wherein it sleeps for one second then attempts to read and copy further records from the input file). This is useful when monitoring text being written to a file by another process. If no file argument is specified and the input is a pipe (FIFO), the -f option is ignored.

number

Decimal integer indicating quantity of output to be copied, measured in units specified by accompanying option. If number is preceded by a + character, copy operation starts number units from beginning of file. If number is preceded by a - character or the option name, copy operation starts number units from end of file. If number is not preceded by a b, c, or n option, -n is assumed. If both the option and number are not specified, -n 10 is assumed.

-b number

Copy file beginning number 512-byte blocks from end or beginning of file. If number is not specified, -b 10 is assumed. See number description above.

-c number

Copy file beginning number bytes from end or beginning of file. If number is not specified, -c 10 is assumed. See number description above.

-n number

Copy file beginning number lines from end or beginning of file. If number is not specified, -n 10 is assumed. See number description above.

file

Name of file to be copied. If not specified, the standard input is used.

If the -c option is specified, the input file can contain arbitrary data. Otherwise, the input file should be a text file.

Obsolescent Form

In the obsolescent form, option letters can be concatenated after the number argument to select blocks, bytes, or lines. If this syntax is used, ±number must be the first argument given. If number is not specified, -10 is assumed. This version is provided for backward compatibility only. The forms discussed previously are recommended for portability.

EXTERNAL INFLUENCES

Environment Variables

LC_CTYPE determines the locale for the interpretation of sequences of bytes of text data as characters (e.g., single- versus multibyte characters in arguments and input files).

LC_MESSAGES determines the language in which messages are displayed.

If LC_CTYPE or LC_MESSAGES is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG.

If any internationalization variable contains an invalid setting, tail behaves as if all internationalization variables are set to "C". See environ(5).

International Code Set Support

Single- and multi-byte character code sets are supported. However, the b and c options can break multi-byte characters and should be used with caution in a multi-byte locale environment.

EXAMPLES

Print the last three lines in file file1 to the standard output, and leave tail in ``follow'' mode:

tail -fn 3 file1 tail -3 -f file1

Print the last 15 bytes of file logfile followed by any lines that are appended to logfile after tail is initiated until it is killed:

tail -fc15 logfile tail -f -c 15 logfile

Three ways to print an entire file:

tail -b +1 file tail -c +1 file tail -n +1 file

WARNINGS

Various kinds of anomalous behavior may occur with character special files. For piped output, tail is limited in its output and depends on process limits.

SEE ALSO

dd(1), head(1).

STANDARDS CONFORMANCE

tail: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.