document updated 1 year, 6 months ago, on Nov 10, 2022

how to disable buffering for various Linux/Unix commands

Many text-based commands will buffer their output. This makes it efficient to process very large text files, but it can cause serious lag/"stuttering" when interactively watching the output of, for example, tail -f.

grep --line-buffered

perl -e '$|++'

awk '{ print $0; fflush(stdout) }'

sed -u

tail -f — (TODO: I believe this automatically disables buffering, but I'm not 100% sure.)