1

This question already has an answer here:

I have a command that processes data slowly. The command processes lines from a file and writes the results to the output file data.txt:

my_command > data.txt

The issue I have is that I'd like to examine output lines in the data.txt file as they are processed. The problem is that no output appears in my output file until the OS decides to dump data to the output file, which happens every few hours. Is there anyway I can force data to be flushed to the file more frequently?

marked as duplicate by slm, goldilocks, jasonwryan, Mat, Anthon Aug 29 '13 at 4:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

One option is to unbuffer your command's stdout using stdbuf from GNU Coreutils. I doubt I would be able to explain the technicalities behind it any better than the author does here

Not the answer you're looking for? Browse other questions tagged or ask your own question.