Examples (8)
Redirect `stdout` to a file
command > path/to/fileAppend to a file
command >> path/to/fileRedirect both `stdout` and `stderr` to a file
command &> path/to/fileRedirect `stderr` to `/dev/null` to keep the terminal output clean
command 2> /dev/nullClear the file contents or create a new empty file
> path/to/fileRedirect `stderr` to `stdout` for piping them together
command1 2>&1 | command2Open a persistent file descriptor
exec 3>path/to/fileWrite to a custom file descriptor
echo text >&3made by @shridhargupta | data from tldr-pages