Thursday, April 25, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 431  / 1 Year ago, sat, december 17, 2022, 5:48:20

I want to know how to tail a log file when lines in the files are updating(appending and removing)?


More From » log

 Answers
7

As Atari911 said, you can use watch along with cat to do this. Use



watch cat <filename>


this will output the contents of the file given by filename every 2 seconds to standard output. To change the interval for updating the output to something like 1 second(you can't reduce beyond 0.1), you can use



watch -n 1 cat <filename>


I am using cat to output the complete file, you could tail but that would only give you the last n lines of the file, where n is 10 by default.



Refer to the manual page of watch for more info.


[#27266] Saturday, December 17, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
erettor

Total Points: 303
Total Questions: 121
Total Answers: 103

Location: Colombia
Member since Mon, May 2, 2022
2 Years ago
;