/dev/null is a file where you can discard the output of the command executed.
This file is also called as Bit Bucket.
eg :
>ls -ltr > /dev/null
>
Here the output of command ls is never shown on terminal STDOUT. It is redirected to bit bucket.
Sometimes we need not display the output as well as error message of command.In this case use the following command.
> command > /dev/null 2>&1
The command output is redirected to /dev/null.Also the error output, STDERR (which is called by 2) is redirected to STDOUT (called as 1 ).That means the error will be redirected to /dev/null.
Comments
Post a Comment