Text file viewer that automatically refreshes when file changes? [duplicate]

I have a text-file that is being continually written to by another program. gedit can refresh the text file contents by going to File -> Revert, but this requires manual input. Is there a text-file viewer (doesn't have to be GUI, a terminal viewer works fine) that automatically updates the contents of the file without manual input?


Solution 1:

If your text-file grows with new content append to it, you could use tail to track changes.

It could be achieved with tail -f text-file or tailf text-file

If you want to print the content in it from very beginning (or from certain line):

tail -n +1 -f text-file

"-n +1" for starting from the first line of it, more detailed explaination could be found in man tail:

-n, --lines=K
output the last K lines, instead of the last 10; or use -n +K to output lines starting with the Kth