stdin, stderr, stdout
1. stdin
stdinFile descriptor 0
2. stdout
stdoutFile descriptor 1
3. stderr
stderr File descriptor 2
4. &>
&> 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
commandto thefile.txtfileThe first command uses the bash-specific
&>redirection operatorFor other shell (eg. zsh, dash etc.) we have to use the more formal syntax indicated in the second line
Note that
>can be replaced with1>too
Last updated