Updated: 04 May 2023
0 – stdin the standard input stream.
1 – stdout the standard output stream.
2 – stderr the standard error stream.
Redirecting output
ls -la > file.out
is equivalent to
ls -la 1> file.out
To redirect stderr
command 2> file.err
Sending both stderr and stdout to separate files
command 2> error.txt 1> output.txt
To suppress error messages in the terminal redirect to /dev/null
command 2> /dev/null
Redirect stderr to the current location of stdout and have error messages sent to the same file as standard output
command > file 2>&1