Redirect stderr and stdout in Bash [duplicate]

I want to redirect both standard output and standard error of a process to a single file. How do I do that in Bash?


Take a look here. It should be:

yourcommand &> filename

It redirects both standard output and standard error to file filename.


do_something 2>&1 | tee -a some_file

This is going to redirect standard error to standard output and standard output to some_file and print it to standard output.