Skip to content

Instantly share code, notes, and snippets.

@jsatt
Last active April 13, 2016 13:31
Show Gist options
  • Save jsatt/6391723 to your computer and use it in GitHub Desktop.
Save jsatt/6391723 to your computer and use it in GitHub Desktop.
stderr and stdout to file
# stdout to file
echo test > file.txt
# stdout append to file
echo test >> file.txt
# stderr to file
cmd 2> file.txt
# stderr to stdout
cmd 2>&1
# stdout to std err
cmd 1>&2
# stderr and std out to file
cmd &> file.txt
# stderr and stdout from cron
cmd > file.txt 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment