home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: tabs Chapter 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 n th 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 n th 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: tabs UNIX in a Nutshell: System V Edition Next: Reference: talk
Reference: tabs Book Index Reference: talk

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