STDBUF(1) General Commands Manual STDBUF(1)

stdbufconfigure I/O buffers

stdbuf [-i size] [-o L|size] [-e L|size] program [argument]…

Configures libstdbuf(3) then executes program arguments with it loaded.

size is in the case-insensitive format:

[base][KMGTPEZY][B] (with at least one of {base, KMGTPEZY, B})
Where base is an optionally-floating-point number of bytes, defaulting to 1, which is then optionally multiplied by the relevant unit. B sets the unit multiplier to (from ). size is equal to base·unitmult , if any, or base.

If size works out to 0, the stream is unbuffered, If L (l) is specified, the stream is line-buffered. This is forbidden for the standard input stream as it's meaningless.

, --input=size
Configures buffering for the standard input stream.
, --output=L|size
Configures buffering for the standard output stream.
, --error=L|size
Configures buffering for the standard error stream.

Appended with a path to libstdbuf(3). On Darwin, DYLD_INSERT_LIBRARIES is used and DYLD_FORCE_FLAT_NAMESPACE=1 is set, instead.

program wasn't found.
program exists, but couldn't be executed for a different reason.
an error occurred in stdbuf.
All others
returned by program.

Normally, grep would buffer incoming CIFS connections because the output leads is a pipe. By employing stdbuf, each connection is displayed as soon as it lands in the log:

tail -f /var/log/messages | stdbuf -oL grep 'DPT=445' | cat -n

libstdbuf(3), ld.so(8)

Originates from the GNU system, also available in FreeBSD 8.4.

The GNU system disallows lower-case L, size with B but without a multiplier, as well as lower-case B, and only supports integer bases.

FreeBSD supports a simplified 0|L|B|size[] buffer size spec (where B means BUFSIZ).

NetBSD 7.1 includes a similar facility natively in its Standard C Library (libc, -lc) as STDBUF[n]=|L|[size]; the example above could be re-written as

tail -f /var/log/messages | STDBUF1=L grep 'DPT=445' | cat -n
June 6, 2023 voreutils pre-v0.0.0-latest