Now say you want to redirect both standard outputs and errors to the same file. Do this: ls -l /bin/usr > ls-output.txt 2>&1. This moves the outputs to the ls-output.txt then redirects errors to 1 (which is the file descriptor for outputs. Remember to put the error redirection at the end of the command, or it won't work. That's the old way. There is a new way to redirect both to the same file. Try this out: ls -l /bin/usr &> ls-output.txt. Less typing = good!
Do you hate error messages? Me too! So lets just throw them away. I don't want to see it on my screen, so I can type this command that probably sounds familiar to some and is quite the joke to others: ls -l /bin/usr 2> /dev/null. /dev/null is a universally known concept in Unix that tosses all those bits into a bucket and does absolutely nothing with them.
Next time on HakTip, let's have some fun with cats! Tell me about your ideas in the comments or email me tips@hak5.org with your thoughts. And be sure to check out our sister show, Hak5 for more great stuff just like this. I'll be there, reminding you to trust your technolust.



