BASH redirect streams such as STDERR and STDOUT

Published: Friday, 14 April 2006

Example that runs, and redirects all STDERR to STDOUT so you can use a pager.

$ ./ 2>&1 | less

The important part is 2>&1, which says STDERR, which is 2, should be redirected to STDOUT, which is 1.


Bash Programing intro