Shell redirection cheatsheet Examples stdout to file stderr to file stdout to stderr stderr to stdout stdout and stderr to file Reference Examples stdout to file $ /bin/exec >/path/to/file.out stderr to file $ /bin/exec 2>/path/to/file.out stdout to stderr $ /bin/exec 1>&2 stderr to stdout $ /bin/exec 2>&1 stdout and stderr to file $ /bin/exec &>/path/to/file.out # as an alternative $ /bin/exec >/path/to/file.out 2>&1 Reference http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html