flag of the United Kingdom

Chasing Your Tail

Date:  Sun, 7th-Nov-2004prevnext

Tags: Shell, Unix

Dog, chasing it's tail.

I've just discovered the *nix command, tail - and what a useful command it is.

In its simplest form, tail displays the last 10 lines of a file. Now I appreciate that this doesn't sound very exciting, but tail has a particularly useful trick up its sleeve... the -F option.

When used with the -F option, tail will automatically follow a file, continually sending appended data to standard output.

If you're still not excited, connect to your web-server, with telnet or an SSH client, and enter the following command:

tail -F /usr/local/apache/logs/access_log

(Substitute /usr/local/apache/logs/access_log for the path to your web-server's "access_log" file.)

You should see a log of access requests for your website that is updated in real-time!

tail is great for watching any log: accesses, errors, firewall, IDS, proxy, etc.

You can comment on this entry, or read what others have written (3 comments).