Quick snippet, as I was searching for this one today.
You can output both standard and error output to both screen and log file with the below command:
my_command.sh 2>&1 | tee my_command.log
Explanation:
my_command.sh
- replace with your command (possibly including arguments)
2>&1
- redirects standard error to standard output, otherwise only standard output is written to file
| tee
- my_command.log pipes the output to tee, which writes both to screen and file