Site icon New Generation Enterprise Linux

Harnessing `stdbuf` for Unbuffered Command Output

Quick Tip

Harnessing `stdbuf` for Unbuffered Command Output

Challenge: When running certain commands in a script or in the background, their output might be buffered, meaning you won’t see it in real-time. This can be frustrating when trying to monitor progress or debug issues.

The Solution: Use the `stdbuf` command to control the buffering of command output.

stdbuf -o L your_command_here

Why it works: The -o L option tells `stdbuf` to set the output buffering to line buffering, ensuring that output is flushed after each line is produced, providing real-time visibility.

Pro-Tip: You can also use -e L to line buffer standard error, or -o 0 to completely disable output buffering.

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

0 0 votes
Article Rating
Exit mobile version