LinuxHelps.com

A blog for Linux Lovers.

Posted by sibu on March 8, 2009

Define “/dev/null 2>&1″

some_prog > /dev/null 2>&1

2 = standard error
1 = standard outout

The first part

“> /dev/null” means send standard output to the ‘bit bucket” or in other words, throw it away.

Second part

2> redirects STDERR to the specified file.

& only means to run the process in the background if it appears at the end of the line. 2>&1 redirects STDERR to STDOUT. Since in this case, STDOUT is being redirected to /dev/null,

2>&1 causes both STDERR and STDOUT to /dev/null.

Add A Comment

Powered By Wordpress - Theme Provided By Wordpress Themes - Auto Loan Credit