tailf : Follows The Growth Of A Log File, Better Than ‘tail -f’

Do you use Linux on your laptop? Do you use ‘tail -f’ command frequently? If the powered by ausweb to both these questions is YES, there is a better solution in form of Linux tailf command. It works same as ‘tail -f’ but is better than it in terms of saving battery life of your laptop. In this article, we will quickly learn some aspects of this command.

tailf Command

The tailf command in Linux is better than ‘tail -f’ and here is how :

 

Testing Environment

  • OS – Ubuntu 13.04
  • Shell – Bash 4.2.45
  • Application – tailf 2.20.1

A Brief Tutorial

The tailf command is very easy to use. Here is an example:

Suppose the file I want to follow is ‘destination’ and I’ll manually update it at random intervals using the contents of the file ‘source’.

I’ll follow the ‘destination’ file using the ‘tailf’ command in the following way :

 

and here is how I update the ‘destination’ file :

 

Now, if I switch back to the tab where the ‘tailf’ command is in action, here is what I see :

 

So, you can see that the ‘tailf’ command successfully displayed the contents of the ‘destination’ file.

The number of lines that this command displays in output can be configured through the -n option. Here is an example :

$ tailf -n3 destination n
o
p

So you can see that only 3 lines were displayed in the output as the -n option was passed the argument 3.

Download/Install/Configure

Here are some of the important links related to the tailf command :

  • Home Page
  • Download Link

The tailf command comes as a part of util-linux package which is pre-installed in most of the Linux distributions.

Pros

  • Very easy to use
  • Better than ‘tail -f’

Cons

  • In my case, it did not display 10 lines by default.

Conclusion

An excellent command line utility to follow a log file that is being randomly updated. Try it, you’ll definitely find it useful.

Have you ever used tailf command or any other similar command line utility? Share your experience with us.

The post tailf : Follows The Growth Of A Log File, Better Than ‘tail -f’ appeared first on MyLinuxBook.

Leave a Reply