Tom Ordonez

Data Science, Machine Learning, Growing Teams

Redirect stdout and stderr in bash


This is how to redirect stdout and stderr in bash.

Redirect stdout and stderr in bash

Search for:

  • IO redirection in Linux
  • input redirection Linux
  • output redirection Linux
  • file descriptors bash

As seen here.

Redirect stdout to file "filename."

1>filename

Redirect and append stdout to file "filename."

1>>filename

Redirect stderr to file "filename."

2>filename

Redirect and append stderr to file "filename."

2>>filename

Redirect both stdout and stderr to file "filename."

&>filename

Redirect stderr to stdout.

2>&1

If you have questions or comments please add them below

Ask Question or Comment