Following files using tail

Tail is a useful command which allows you to see the end of a file. This is probably most commonly used when you want to look at log files as the entries of most interest are usually at the bottom. For example, if you wanted to view the last 50 lines of a log file you could use the following command.

tail -n 50 filename.log

A cool feature of tail is that you can also follow a file – that means continually monitoring it as changes come in. So if you are looking at the Apache error log for example, you could begin tailing the log and then cause an error and you will see it instantly come through on the log.

tail -f error_log
Timeline

Newsletter

Don't have time to check my blog? Get a weekly email with all the new posts. This is my personal blog, so obviously it is 100% spam free.

Metadata

Tags: , , , ,

This entry was posted on Saturday, March 3rd, 2012 at 11:17 am and is filed under Life, Tech. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.