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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.