Redirect stdout
:
command > file
command 1> file
Redirect stderr
:
command 2> file
Redirect stderr
to stdout
:
command 2>&1 file
Redirect stderr
and stdout
:
command > file 2>&1
command &> file # non-POSIX, i.e. less compatible
Clear a file:
:> file
true > file # same as above
Make file executable:
chmod +x <file>