# info > stdbuf

---
type: CommandReference
command: stdbuf
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `stdbuf -o L command` — line buffer stdout
- `stdbuf -e L command` — line buffer stderr
- `stdbuf -o 0 command` — unbuffer stdout
- `stdbuf -i 0 command` — unbuffer stdin
- `stdbuf -o SIZE command` — fully buffer stdout with buffer size
- `stdbuf -e SIZE command` — fully buffer stderr with buffer size
- `stdbuf -o L -e L command` — line buffer both stdout and stderr
- `stdbuf -i L command` — invalid for input (MODE L not allowed on stdin)

## Name

`stdbuf` — Run a command with modified I/O stream buffering.

## Synopsis

shell
stdbuf OPTION... COMMAND [ARG]...
## Options

- `-i MODE`, `--input=MODE` — Adjust the buffering of the standard input stream.
- `-o MODE`, `--output=MODE` — Adjust the buffering of the standard output stream.
- `-e MODE`, `--error=MODE` — Adjust the buffering of the standard error stream.

**MODE** can be:

- `L` — Line buffered mode. Data is coalesced until a newline is output or input is read from any stream attached to a terminal device. This option is invalid with standard input.
- `0` — Disable buffering. Data is output immediately; input reads only the amount requested. Note: disabling input buffering does not affect the blocking behavior of stream input functions (e.g., `fread` still blocks until `EOF` or error).
- `SIZE` — Fully buffered mode with a buffer of the given size. SIZE may be an integer optionally followed by a multiplicative suffix:
  - `KB` => 1000 (KiloBytes)
  - `K`  => 1024 (KibiBytes)
  - `MB` => 1000*1000 (MegaBytes)
  - `M`  => 1024*1024 (MebiBytes)
  - `GB` => 1000*1000*1000 (GigaBytes)
  - `G`  => 1024*1024*1024 (GibiBytes)
  - and so on for `T`, `P`, `E`, `Z`, `Y`. Binary prefixes: `KiB`=K, `MiB`=M, etc.

**Notes:**  
- `stdbuf` is installed only on platforms that use ELF and support the `constructor` attribute. Portable scripts should not rely on its existence.  
- COMMAND must use ISO C `FILE` streams (e.g., `dd` and `cat` do not) and must not adjust the buffering of its standard streams (e.g., `tee` does adjust).

## See Also

- [nohup(1)](https://man7.org/linux/man-pages/man1/nohup.1.html)
- [timeout(1)](https://man7.org/linux/man-pages/man1/timeout.1.html)
- [nice(1)](https://man7.org/linux/man-pages/man1/nice.1.html)
- [ionice(1)](https://man7.org/linux/man-pages/man1/ionice.1.html)
- [chrt(1)](https://man7.org/linux/man-pages/man1/chrt.1.html)
- [taskset(1)](https://man7.org/linux/man-pages/man1/taskset.1.html)
- Coreutils common options (see `info coreutils 'Common options'`)

## Exit Codes

- `125` — `stdbuf` itself failed
- `126` — COMMAND is found but cannot be invoked
- `127` — COMMAND cannot be found
- Otherwise, the exit status of COMMAND