Redirect output to a file without buffering on linux/mac?

https://serverfault.com/questions/294218/is-there-a-way-to-redirect-output-to-a-file-without-buffering-on-unix-linux

https://serverfault.com/questions/294218/is-there-a-way-to-redirect-output-to-a-file-without-buffering-on-unix-linux

This buffers stdout up to a line:

stdbuf -oL command > output

This disables stdout buffering altogether:

stdbuf -o0 command > output

This disables stdout buffering altogether:

stdbuf -o0 command > output
//setbuf(stdout, NULL);
//fflush(stdout); // Will now print everything in the stdout buffer

stdbuf -i0 -o0 -e0 ./bin.x > bin.log
stdbuf -i0 -o0 -e0 ./bin.x | sed -n 'w bin.log' & tail -f bin.log

Published by moon_man

34 y.o. human from the Moon

Leave a comment

Your email address will not be published. Required fields are marked *