eg1$ ls >dir-contents
eg2$ tar cvf backup.tar >tar.log 2>&1
eg3$ find / -name \*.c >find.log 2>/dev/null
Input Redirection. Input to a program may be obtain from a file by using the <, <<TAG operators.
eg1$ xargs pgrep <file-of-files
TIP: Never use cat
with a pipe when you
could've just redirected. People will laugh at you. e.g.
hip$ somecommand <file
doh$ cat file | somecommand
Finally, redirections can occur anywhere on the line:
sohip$ <file somecommand