Master `stdbuf` for Unbuffered Command Output

Quick Tip

Master `stdbuf` for Unbuffered Command Output

Challenge: When piping output from certain commands in Linux, you might notice a delay or buffering, especially when dealing with interactive applications or when trying to process output in real-time. This can hinder immediate feedback and break real-time processing pipelines.

The Solution: Use the `stdbuf` command to control the buffering of command output. You can specifically target `stdout` (standard output) and set it to `L` (line buffering) or `0` (unbuffered).

stdbuf -oL your_command | another_command

Why it works: `stdbuf -oL` instructs the shell to set the standard output of `your_command` to line buffering. This ensures that each line of output is flushed immediately, preventing delays caused by larger buffer sizes.

Pro-Tip: To completely disable buffering for a command, use `stdbuf -o0 your_command`.

Linux Tips & Tricks | © ngelinux.com | 5/3/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments