COMMAND
ls -l 2>&1 | tee output.txt
BASH
bash.sh 2>&1 | tee output.txt
2>&1 = direct both STDOUT & STDERR to the same place
| = pipe = sends command before into something after
tee = command line program that write console output (stdout) to console and to a file
output.txt = file name for STDOUT & STDERR
ls -l 2>&1 | tee output.txt
BASH
bash.sh 2>&1 | tee output.txt
2>&1 = direct both STDOUT & STDERR to the same place
| = pipe = sends command before into something after
tee = command line program that write console output (stdout) to console and to a file
output.txt = file name for STDOUT & STDERR
Post Specific to Ubuntu Linux