Sunday, April 13, 2014

Redirect STDOUT and STDERR to STDOUT and also to a file

command 2>&1 | tee -a filename.txt

eg

ls 2>&1 | tee -a  directory_list.txt