There are two main output streams in Linux (and other OSs), standard output (stdout) and standard error (stderr).
Error messages, like the ones you show, are printed to standard error. The classic redirection operator (command > file) only redirects standard output, so standard error is still shown on the terminal. To redirect stderr as well, you have a few choices:
Redirect stdout to one file and stderr to another file:
command > out 2>errorRedirect stdout to a file (
>out), and then redirect stderr to stdout (2>&1):command >out 2>&1Redirect both to a file (this isn't supported by all shells,
bashandzshsupport it, for example, butshandkshdo not):command &> out
For more information on the various control and redirection operators, see here.
No comments:
Post a Comment