| STDBUF(1) | General Commands Manual | STDBUF(1) |
stdbuf — change
standard streams initial buffering
stdbuf |
[-e bufdef]
[-i bufdef]
[-o bufdef]
[command [...]] |
stdbuf is used to change the initial
buffering of standard input, standard output and/or standard error streams
for command. It relies on
libstdbuf(3) which is loaded and
configured by stdbuf through environment
variables.
The options are as follows:
-e
bufdef-i
bufdef-o
bufdefThe buffer style and size is defined as follows:
In the following example, the stdout stream of the
awk(1) command will be fully buffered by
default because it does not refer to a terminal.
stdbuf is used to force it to be line-buffered so
iostat(8)'s output will not stall until
the full buffer fills.
# iostat 1 | stdbuf -o L awk '$2 > 1 || $5 > 1' | cat -n
The stdbuf utility first appeared in
FreeBSD 8.4.
The original idea of the stdbuf command
comes from Padraig Brady who implemented it in the
GNU coreutils. Jeremie Le Hen implemented it on
FreeBSD.
| June 29, 2023 | macOS 26.4 |