Log Bash Command Output to a File
tl;dr: Use redirection, >
and >>
etc.
command > file.xt # redirect stdout
command 2> file.txt # redirect stderr
command &> file.txt # redirect both stdout and stderr
tl;dr: Use redirection, >
and >>
etc.
command > file.xt # redirect stdout
command 2> file.txt # redirect stderr
command &> file.txt # redirect both stdout and stderr