Skip to content

Instantly share code, notes, and snippets.

@pankajparashar-zz
Last active December 20, 2015 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pankajparashar-zz/6071373 to your computer and use it in GitHub Desktop.
Save pankajparashar-zz/6071373 to your computer and use it in GitHub Desktop.
All about redirection - 0(stdin) 1(stdout) 2(stderr)
1. redirect stdout to a file
ls -l > ls-l.txt
2. redirect stderr to a file
grep da * 2> grep-errors.txt
3. redirect stdout to a stderr
grep da * 1>&2
4. redirect stderr to a stdout
grep * 2>&1
5. redirect stderr and stdout to a file
rm -f $(find / -name core) &> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment