What is /dev/null 2>&1?

>> /dev/null redirects standard output (stdout) to /dev/null, which discards it.

(The >> seems sort of superfluous, since >> means append while > means truncate and write, and either appending to or writing to /dev/null has the same net effect. I usually just use > for that reason.)

2>&1 redirects standard error (2) to standard output (1), which then discards it as well since standard output has already been redirected.

转自: http://stackoverflow.com/questions/10508843/what-is-dev-null-21

原文地址:https://www.cnblogs.com/pinganzi/p/5291392.html