stdbuf

modify buffering

Run command, with modified buffering operations for its standard streams. stdbuf option… command

Run command with modified buffering operations for its standard streams.

i
--input=0|n
adjust standard input stream buffering
o
--output=L|0|n
adjust standard output stream buffering
e
--error=L|0|n
adjust standard error stream buffering
-help display this help and exit
-version output version information and exit
L the stream will be line buffered.

0 the stream will be unbuffered.

n is a number which may be followed by one of the following: KB=1000, K=KiB=1024, MB 1000*1000, M=MiB+1024*1024, and so on for G, T, P, E, Z, Y stream will be fully buffered with the buffer size of n

If COMMAND adjusts the buffering of its standard streams ('tee' does for example) then that will override corresponding changes by 'stdbuf'. Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, and are thus unaffected by 'stdbuf' settings.

EXAMPLES

Immediately display unique entries from access.log Linebuffering the output from cut
 tail -f access.log | stdbuf --output=L cut -d ' ' -f1 | uniq