Forrest logo
back to the stdbuf tool

stdbuf:tldr:7eb0c

stdbuf: Change the standard error buffer to unbuffered.
$ stdbuf --error=${0} ${command}
try on your machine

The command stdbuf --error=${0} ${command} is used to execute a given command with the standard output buffering turned off, and the error output redirected to a file named as the same name as the script or program being executed.

Here's the breakdown of the command:

  • stdbuf is a command that modifies the buffering operations of another command.
  • --error=${0} is an argument passed to stdbuf where ${0} represents the name of the script or program being executed. It sets the error output file to be the same name as the script or program (with no file extension).
  • ${command} is a placeholder representing the actual command that you want to execute, which can be any valid command or program.

By using this command, you can control the buffering behavior and redirect the error output to a specific file. The script or program will be executed normally, but the error messages will be captured in the file named after the script/program name.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the stdbuf tool