Skip to content

Instantly share code, notes, and snippets.

@weirdpattern
Last active July 19, 2018 20:24
Show Gist options
  • Save weirdpattern/ce54fdb1e5621b5966e146026995b974 to your computer and use it in GitHub Desktop.
Save weirdpattern/ce54fdb1e5621b5966e146026995b974 to your computer and use it in GitHub Desktop.
.2016.08.31.stream-redirection
2016.08.31.stream-redirection
# no redirection
$ echo 'hello'
hello
# redirects standard error (no error in this case)
$ echo 'hello' 2> /dev/null
hello
# redirects standard out to /dev/null (so no output)
$ echo 'hello' 1> /dev/null
# redirects everything to /dev/null (so no output)
$ echo 'hello' &> /dev/null
# no redirection (causing error)
$ unlink unexisting-file.sh
unlink: unexisting-file.sh: No such file or directory
# redirects standard error to /dev/null (so no error)
$ unlink unexisting-file.sh 2> /dev/null
# redirects everything to /dev/null (so no error)
$ unlink unexisting-file.sh &> /dev/null
<operation> [n]> /dev/null [options]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment