stdin
File descriptor 0
stdout
File descriptor 1
stderr
File descriptor 2
&>
Bash-specific shortcut: indicates redirection for both stdout and stderr
command &> file.txt # bash specific command > file.txt 2>&1
Both commands redirects both stdout and stderr from command to the file.txt file
command
file.txt
The first command uses the bash-specific &> redirection operator
For other shell (eg. zsh, dash etc.) we have to use the more formal syntax indicated in the second line
Note that > can be replaced with 1> too
>
1>
Last updated 1 month ago