In the Bash shell, you can redirect the output and errors of a command to /dev/null
to suppress them. /dev/null
is a special file that discards all data written to it, so redirecting output or errors to /dev/null
effectively discards them.
Here is an example of how you can redirect the output and errors of a command to /dev/null
:
command > /dev/null 2>&1Source:www.lautturi.com
The > /dev/null
part of the command redirects the standard output (stdout) of the command
to /dev/null
, and the 2>&1
part redirects the standard error (stderr) to /dev/null
.
You can also use the &> /dev/null
syntax to redirect both stdout and stderr to /dev/null
:
command &> /dev/null