Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

*/5 * * * * /usr/local/bin/php somephpfile.php>> /dev/null 2>&1

What exactly does the dev/null 2 mean?

Thanks

share|improve this question
add comment

3 Answers 3

up vote 2 down vote accepted

It's redirecting STDER (Standard Error) to go along with STDOUT (Standard Out). In short, both of them are redirected to /dev/null, meaning no output from the program is ever displayed.

share|improve this answer
1  
So that you don't get an email if the command output something :) –  Nicolas Viennot Jun 24 '10 at 23:54
add comment

2>&1 means "send stderr to stdout."

>>/dev/null means "append stdout to /dev/null," which is a way of hiding program output by sending it into /dev/null, whose only purpose in life is to act like a black hole for data. (Strictly speaking, for /dev/null, >>/dev/null is the same as >/dev/null.)

These rules are evaluated from right to left, so in combination they say, "hide everything output to stderr and stdout." A common mistake is to specify them in the reverse order, which will not hide the stderr output.

Also worth knowing: you can explicitly send both streams to /dev/null by saying 1>/dev/null 2>/dev/null or &>/dev/null rather than sending stderr to stdout and then sending stdout to /dev/null.

share|improve this answer
    
this was the best answer as it was explained the best. However I had already picked an answer :S –  jini Jun 24 '10 at 22:25
add comment

It means redirect standard error and standard output to nothing (throw it away).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.