Say I've got a text file file.txt
and program program.rb
. program.rb
writes stuff to file.txt
as program.rb
finds it. How can I view the population of the text file from the terminal?
Asked
Active
Viewed 397 times
1

Gilles 'SO- stop being evil'
- 829,060

Forwarding
- 21
1 Answers
3
This is commonly done with tail -f
:
$ tail -f file.txt
The tail
utility outputs the tail of a file or stream, i.e. the last part of it (the 10 last lines by default). With the -f
flag, it will not exit once it has arrived at the end, but continue polling the file or stream for new data and output it whenever it arrives.
This is commonly done to manually monitor log files, or, as in your case, to view the partial result of a running program.
See also question 291932 to learn the difference between tail -f
and tail -F
.

Kusalananda
- 333,661
tail -f file.txt
? – Aug 16 '16 at 04:07