Redirect Stdout to a file.
cmd > file.log
cmd 2> file.log
Redirect both Stderr and Stdout to a file.
cmd &> file.log
cmd > file.log 2>&1
Stderr to stdout
cmd 2>&1
Tying it together
Pipe only Stdout to a program.
cmd | less
Pipe only Stderr to a program.
cmd 2>&1 > /dev.null | less
cmd 3>&1 1>&2 2>&3 | less
Pipe both Stderr and Stdout to a program.
cmd 2>&1 | less
No comments:
Post a Comment