This question already has an answer here:
- Turn off buffering in pipe 13 answers
I have a command that processes data slowly. The command processes lines from a file and writes the results to the output file
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?