Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make output of any shell command unbuffered?

Is there a way to run shell commands without output buffering?

For example, hexdump file | ./my_script will only pass input from hexdump to my_script in buffered chunks, not line by line.

Actually I want to know a general solution how to make any command unbuffered?

like image 275
bodacydo Avatar asked Aug 12 '10 07:08

bodacydo


1 Answers

Try stdbuf, included in GNU coreutils and thus virtually any Linux distro. This sets the buffer length for input, output and error to zero:

stdbuf -i0 -o0 -e0 command 
like image 64
lambshaanxy Avatar answered Oct 22 '22 13:10

lambshaanxy