The Tale of Tail (Unix Command)

Unix Tail Function

The most interesting and useful command i ever used is tail in unix. As the name indicate its duty is to show the last lines of a particular file. When take the case of log files such as error logs, always we have to know the last lines or last updations instead of reading from top to bottom or search a full text file.

for its option try this tail –help

tail -n 10 error.log

shows last 10 lines of error.log

The very interesting option is -f , means open the file and follow the last lines.

This is very useful for debugging purpose. For example if you want to check error.log lively, use this option

tail -f error.log

it displays last lines and also automatically updates when any changes happens in error.log file. So you can check other operation by tailing and following a particular file .

Try today itself. You will be very much interested, thats my guarantee :)

(There is also a similar function ‘head’, you can guess what its use, google it for more)

Regards

Sajith

2 Comments , , , , , ,

2 Responses to “The Tale of Tail (Unix Command)”

  1. Anoop P Alias March 6, 2008 at 11:23 pm #

    A very good option of tail is

    tail -f file

    This will follow the file and update any updates at the end of the file.Good if you want to watch last entries being updated on a log file :)

  2. Christopher July 5, 2009 at 12:38 pm #

    This is really good for me, as I want to watch last entries being updated on a log file! :) Thanks!!!

Leave a Reply

More in linux (2 of 7 articles)


Steps: 1) sudo apt-get install ntfs-3g Installs ntfs-3g library 2) sudo fdisk -l Shows all the disk drives 3) ...