Save what would have hit the screen
cmd > file sends stdout to file, replacing whatever was there. cmd >> file appends to it. The screen stays empty unless the program also writes to stderr.
Truncate vs append
>— overwrite. The file is truncated to zero before the command runs.>>— append. Existing content stays.
The truncation happens early: cmd > file blanks file even if cmd immediately fails. If you want fresh-write-or-fail, use >| with set -o noclobber (see callout below).
Stdin redirection from a file
cmd < file sends file contents to cmd's stdin. wc -l < lines.txt counts lines without spawning cat. sort < data.txt, tr a-z A-Z < input.txt are the canonical patterns.
Combining redirections
You can stack them: cmd < in.txt > out.txt 2> err.txt. Order doesn't matter for separate fds, but it matters for the same fd: cmd > out.txt 2>&1 sends stderr to wherever stdout currently goes (= out.txt). cmd 2>&1 > out.txt redirects stderr to the original stdout (still terminal!) and only then redirects stdout. Different result.