Skip to Content
Mac OS X in a Nutshell
book

Mac OS X in a Nutshell

by Jason McIntosh, Chuck Toporek, Chris Stone
January 2003
Intermediate to advanced
832 pages
32h 40m
English
O'Reilly Media, Inc.
Content preview from Mac OS X in a Nutshell

Name

tail

Synopsis

tail [options] [file]

Prints the last ten lines of the named file. Use either -f or -r, but not both.

Options

-f

Don’t quit at the end of file; “follow” file as it grows. End with an INTR (usually ^C).

-F

Behaves the same as the -f option with the exception that it checks every five seconds to see if the filename has changed. If it has, it will close the file and open the new file.

-r

Copy lines in reverse order.

-c num

Begin printing at numth byte from the end of file.

-b num

Begin printing at numth block from the end of file.

-n num

Start at numth line from the end of file. -n is the default and does not need to be specified.

[+/-]

To start from the beginning of the file, use + before num. The default is to start from the end of the file; this can also be done by using a - before num.

Examples

Show the last 20 lines containing instances of .Ah:

                     grep '\.Ah' file | tail -20

Continually track the system log:

                     tail -f /var/log/system.log

Show the last 10 characters of variable name:

                     echo "$name" | tail -c -10

Reverse all lines in list:

                     tail -r list
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mac OS X Internals: A Systems Approach

Mac OS X Internals: A Systems Approach

Amit Singh
C++ In a Nutshell

C++ In a Nutshell

Ray Lischner
Linux Shell Scripting Cookbook - Third Edition

Linux Shell Scripting Cookbook - Third Edition

Clif Flynt, Sarath Lakshman, Shantanu Tushar
Optimized C++

Optimized C++

Kurt Guntheroth

Publisher Resources

ISBN: 0596003706Supplemental ContentCatalog PageErrata