b5media.com

Advertise with us

Enjoying this blog? Check out the rest of the Technology Channel Subscribe to this Feed

New Linux User

EXPLAIN: The GNU/Linux ‘Tail’ Command.

by Jon on November 28th, 2005

Canadian Coin
Much like the head command will display the top n number of lines of a specified file, the tail command will display the bottom n number of lines from a specified file.

For example, to see the last 10 lines of my /var/messages file, I can type:

tail /var/messages

the default is 10 lines, but if I wanted to see the last 50 lines, I could type:

tail -50 /var/messages

Unlike the head command, the tail command has a very useful switch. Putting the -f switch after the command will cause tail to go into monitoring mode and continue to output the last n number of lines as the specified file changes.

This is very useful for monitoring your system log files as they change in real time. For example, to monitor the last 10 lines of your system log in a terminal window, become root and type:

tail -f /var/log/syslog

To exit monitoring mode, hit Ctrl-Z.

POSTED IN: Explanation

1 opinion for EXPLAIN: The GNU/Linux ‘Tail’ Command.

Have an opinion? Leave a comment:




Check Spelling
Activate Spell Check while Typing