Полезная информация

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: tabsChapter 2
UNIX Commands
Next: Reference: talk
 

tail

tail [options] [file]

Print the last ten lines of the named file. Use only one of -f or -r.

Options

-f

Don't quit at the end of file; "follow" file as it grows. End with a BREAK (CTRL-C).

-r

Copy lines in reverse order.

-n[k]

Begin printing at nth item from end of file. k specifies the item to count: l (lines, the default), b (blocks), or c (characters).

-k

Same as previous, but use the default count of 10.

+n[k]

Like -n, but start at nth item from beginning of file.

+k

Like -k, but count from beginning of file.

Examples

Show the last 20 lines containing instances of .Ah:

grep '.Ah' file | tail -20

Continually track the latest uucp activity:

tail -f /usr/spool/uucp/LOGFILE

Show the last ten characters of variable name:

echo "$name" | tail -c

Reverse all lines in list:

 tail -r list


Previous: Reference: tabsUNIX in a Nutshell: System V EditionNext: Reference: talk
Reference: tabsBook IndexReference: talk

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System