Skip to content

Instantly share code, notes, and snippets.

@gonzaloserrano
Created September 17, 2013 13:38
Show Gist options
  • Save gonzaloserrano/6594400 to your computer and use it in GitHub Desktop.
Save gonzaloserrano/6594400 to your computer and use it in GitHub Desktop.
How to less stderr
# http://stackoverflow.com/questions/2342826/how-to-pipe-stderr-and-not-stdout
# This creates a new file descriptor (3) and assigns it to the same place as 1 (stdout),
# then assigns fd 1 (stdout) to the same place as fd 2 (stderr) and finally assigns fd 2 (stderr)
# to the same place as fd 3 (stdout). Stderr is now available as stdout and old stdout preserved in stderr.
command 3>&1 1>&2 2>&3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment