When you run any process in Linux, input, output, and errors are tied to default devices: stdin, stdout, and stderr.(descriptors 0, 1, and 2) Any of these can be permanently or temporarily re-directed.
This runs "command" and re-directs any error messages to the file named "errorfile"
To answer the question in your title: Go to http://tldp.org
and get Bash Guide for Beginners. Then, get the Advanced Bash Scripting Guide. Look up redirection.