This redirects stderr as well.

> redirects standard output.  However, this is only file descriptor 1.
File descriptor 2, standard error, is still going to your screen.  So, you
could do this:

[command] >/dev/null 2>/dev/null

However, to save typing, people put 2>&1, because the &1 means to go to
file descriptor 1.  So, the command

[command] >/dev/null 2>&1

Tells the computer to open up file descriptor 1 (aka standard output) as
an output stream to /dev/null, then open up file descriptor 2 (aka
standard error) to write to the same place as file descriptor 1.

Let me know if you have more questions.

Jonathan Bartlett


On Thu, 6 Jun 2002, The Gyzmo wrote:

> Why do you have to put '2>&1' after '/dev/null' when
> piping something to /dev/null, like this:?
>
> [command] > /dev/null 2>&1
>
> =====
> +----------------------------------------------------------+
> |This message is from Serban Giuroiu, also known online    |
> |as The Gyzmo.                                             |
> |E-MAIL: g y z m o b r o @ y a h o o . c o m  (no spaces)  |
> |GAIM Screen Name: g y z m o b r o  (no spaces)            |
> +----------------------------------------------------------+
> "Code Smarter, Not Harder" - off the Desaware t-shirt I have
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
>
>
> _______________________________________________
> Redhat-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-list
>



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to