[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
tail
: Output the last part of files
tail
prints the last part (10 lines by default) of each
file; it reads from standard input if no files are given or
when given a file of `-'. Synopsis:
tail [option]... [file]... |
If more than one file is specified, tail
prints a
one-line header consisting of
==> file name <== |
GNU tail
can output any amount of data (some other versions of
tail
cannot). It also has no `-r' option (print in
reverse), since reversing a file is really a different job from printing
the end of a file; BSD tail
(which is the one with -r
) can
only reverse files that are at most as large as its buffer, which is
typically 32 KiB. A more reliable and versatile way to reverse files is
the GNU tac
command.
If any option-argument is a number n starting with a `+',
tail
begins printing with the nth item from the start of
each file, instead of from the end.
The program accepts the following options. Also see 2. Common options.
tail
prints a header whenever it
gets output from a different file, to indicate which file that output is
from.
There are two ways to specify how you'd like to track files with this option, but that difference is noticeable only when a followed file is removed or renamed. If you'd like to continue to track the end of a growing file even after it has been unlinked, use `--follow=descriptor'. This is the default behavior, but it is not useful if you're tracking a log file that may be rotated (removed or renamed, then reopened). In that case, use `--follow=name' to track the named file by reopening it periodically to see if it has been removed and recreated by some other program.
No matter which method you use, if the tracked file is determined to have
shrunk, tail
prints a message saying the file has been truncated
and resumes tracking the end of the file from the newly-determined endpoint.
When a file is removed, tail
's behavior depends on whether it is
following the name or the descriptor. When following by name, tail can
detect that a file has been removed and gives a message to that effect,
and if `--retry' has been specified it will continue checking
periodically to see if the file reappears.
When following a descriptor, tail does not detect that the file has
been unlinked or renamed and issues no message; even though the file
may no longer be accessible via its original name, it may still be
growing.
The option values `descriptor' and `name' may be specified only with the long form of the option, not with `-f'.
tail
have required that
number be an integer. However, GNU tail
accepts
an arbitrary floating point number.
make
and tail
like this then the tail process will stop when your build completes.
Without this option, you would have had to kill the tail -f
process yourself.
$ make >& makerr & tail --pid=$! -f makerr |
tail
may terminate long before any files stop growing or it may not
terminate until long after the real writer has terminated.
Note that `--pid' cannot be supported on some systems; tail
will print a warning if this is the case.
open
/fstat
the file to determine if that file name is
still associated with the same device/inode-number pair as before.
When following a log file that is rotated, this is approximately the
number of seconds between when tail prints the last pre-rotation lines
and when it prints the lines that have accumulated in the new log file.
This option is meaningful only when following by name.
On older systems, tail
supports an obsolete option
`-countoptions', which is recognized only if it is
specified first. count is a decimal number optionally followed
by a size letter (`b', `k', `m') as in -c
, or
`l' to mean count by lines, or other option letters
(`cfqv'). Some older tail
implementations also support
an obsolete option `+count' with the same meaning as
`-+count'. POSIX 1003.1-2001 (see section 2.5 Standards conformance) does not allow these options; use `-c
count' or `-n count' instead.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |