how to redirect error output code example Example: bash script output and error to file command1 > everything.txt 2>&1 command1 -arg > everything.txt 2>&1