command error redirection

Rick Stevens ricks at nerd.com
Fri Oct 10 16:26:47 UTC 2008


Simon Andrews wrote:
> ANOOP wrote:
>> On Fri, Oct 10, 2008 at 4:03 PM, Gopal Ghosh <gopal016 at gmail.com> wrote:
>>> Dear All,
>>> How top redirect errors of a command to a file
>>
>> # <command> > errorFile
> 
> That would redirect stdout (normal output) rather than the errors.  To 
> redirect standard error you'd usually do:
> 
> # <command> 2> errorfile
> 
> ..assuming you're using bash for your shell.

To capture all output, use

	command >/path/to/file 2>&1

which redirects both stdout and stderr to /path/to/file.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer                      ricks at nerd.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-   I haven't lost my mind.  It's backed up on tape somewhere, but   -
-                       probably not recoverable.                    -
----------------------------------------------------------------------




More information about the fedora-list mailing list