Home » 2017 » August » 22 » Difference between tailf and tail -f in Linux

11:01 PM
Difference between tailf and tail -f in Linux

Today, we shall talk about one of the most frequently used command in Linux.

TAIL

The command is used to print last 10 lines of a file.

tail -f is used to print the last 10 lines plus it keeps on reading the file if a new data is added to the file.

tail -f can be used if a log is currently being updated. 


But then what is the use of tailf?

tailf is similar to tail -f except one difference that tailf does access the file if the file is not being updated or not growing.

 

tailf is extremely useful for monitoring log files on a laptop when logging is infrequent and the user desires that the hard disk spin down to conserve  battery life.

 

It means that tail -f will keep on accessing/reading the file even if its not growing.

This has the side effect of not updating the access time for the file, so a filesystem flush does not occur periodically when no log activity is happening.

 

The tailf command is part of the util-linux-ng package

So now that you know about tailf, start using tailf instead of tail -f to conserve energy :).

 
 

Category: Open System-Linux | Views: 2484 | Added by: shanky | Tags: tail -f, tailf | Rating: 0.0/0

Related blogs


You may also like to see:


[2014-09-21][Open System-Linux]
How to define command prompt strings in Linux : what are $PS1, $PS2, $PS3 and $PS4?
[2014-04-10][Open System-Linux]
SED command for filtering and transforming texts of a file using regular expression
[2015-07-18][Open System-Linux]
Creating and Managing Logical Volume Manager in Linux
[2014-10-24][Open System-Linux]
HEXDUMP command in Linux to display the file content in decimal, hexadecimal, octal format
[2016-12-25][Open System-Linux]
Guide for working with zipped and archived files in Linux/AIX

Total comments: 0
ComForm">
avatar