NAME
stdbuf —
configure I/O buffers
SYNOPSIS
stdbuf |
[-i size]
[-o
L|size]
[-e
L|size]
program
[argument]… |
DESCRIPTION
Configures libstdbuf(3) then executes program arguments with it loaded.
size is in the case-insensitive format:
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.
OPTIONS
-i,--input=size- Configures buffering for the standard input stream.
-o,--output=L|size- Configures buffering for the standard output stream.
-e,--error=L|size- Configures buffering for the standard error stream.
ENVIRONMENT
LD_PRELOAD- Appended with a path to
libstdbuf(3). On Darwin,
DYLD_INSERT_LIBRARIESis used andDYLD_FORCE_FLAT_NAMESPACE=1 is set, instead.
EXIT STATUS
- 127
- program wasn't found.
- 126
- program exists, but couldn't be executed for a different reason.
- 125
- an error occurred in
stdbuf. - All others
- returned by program.
EXAMPLES
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
-nSEE ALSO
HISTORY
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[kmG]
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]=U|L|F[size];
the example above could be re-written as
tail
-f /var/log/messages
|
STDBUF1=L
grep 'DPT=445' |
cat -n