When I have a long running Bash pipeline of commands, and I often can't see any signs of life due to I/O buffering. I found online that buffering can be disabled using
stdbuf
. An example shown [here](https://linux.die.net/man/1/stdbuf) is:
tail -f access.log | stdbuf -oL cut -d aq aq -f1 | uniq
However, it is unclear to me which commands in the pipeline need to be prefixed by the stdbuf
command. I therefore add it to every command. For no buffering, I might do:
cd ~/tmp
stdbuf -i0 -o0 -e0 find /i \! -type d | \
stdbuf -i0 -o0 -e0 sed -u -n -e \
's=.*\&1 | stdbuf -i0 -o0 -e0 tee find.out
This makes my code very noisy in a cognitive sense.
How do I decide which commands need prefixing with stdbuf
?
Asked by user2153235
(467 rep)
Jan 5, 2023, 10:01 PM
Last activity: Jan 5, 2023, 11:11 PM
Last activity: Jan 5, 2023, 11:11 PM