Master `stdbuf` for Unbuffered Command Output

Quick Tip

Master `stdbuf` for Unbuffered Command Output

Challenge: When running long-running commands or scripts that produce output incrementally, you might notice a significant delay before seeing any output, especially when redirecting to a file or piping to another command. This is often due to output buffering.

The Solution: Use the `stdbuf` command to control the buffering of standard input, output, and error streams.

stdbuf -o L your_command_here

Why it works: The `-o L` option tells `stdbuf` to set the output buffering mode to “line buffering,” meaning output will be flushed after every newline character is encountered. This ensures that output appears much more promptly.

Pro-Tip: Use `stdbuf -o0` to completely disable output buffering for the command.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments