Tuesday, August 20, 2013

[Linux Command] Redirect stderr to stdout and output to terminal and log into file at the same time

If you want to redirect stderr to stdout, append this at your command: 2>&1 , and also for outputting to terminal and logging into file you should use tee.
Both together would look like this:
$ yourcommand 2>&1 | tee yourlogfile.log

No comments: