xxxxxxxxxx
What is /dev/null ?
/dev/null is like a black hole, "whatever you write to /dev/null will be discarded, forgotten into the void."
xxxxxxxxxx
> file redirects stdout to file
1> file redirects stdout to file
2> file redirects stderr to file
&> file redirects stdout and stderr to file
2&1> file redirects stdout and stderr to file
/dev/null is the null device it takes any input you want and throws it away. It can be used to suppress any output.
xxxxxxxxxx
> is for redirect
/dev/null is a black hole where any data sent, will be discarded
2 is the file descriptor for Standard Error
> is for redirect
& is the symbol for file descriptor (without it, the following 1 would be considered a filename)
1 is the file descriptor for Standard Out
Therefore >/dev/null 2>&1 is redirect the output of your program to /dev/null. Include both the Standard Error and Standard Out.
Much more information is available at The Linux Documentation Project's I/O Redirection page.
xxxxxxxxxx
'>' is redirect, and then "/dev/null" is both a path, and for this specifically a device. So usually >/dev/null would overwrite null but since is dev/null --its like a linux blackhole
and 2 is stderr so if any errors are thrown the error message is then '>' overwriting &--this-is-end-the-previous-command-because-ampersand. So & 1 is stdout so if any error from the dev/null overwrite else ';;'