Many times when modifying scripts from the internet you will see lines where they put “something something command -argument 2>/dev/null;” and you may wonder what it means.
When they do this, they are simply redirecting stderr to a file, which in this case, is *nix’s black hole file. Whatever goes into it cannot be seen or retrieved.
Here is a good explanation (copied and pasted in case source gets deleted):
If you don’t specify a number then the standard output stream is assumed but you can also redirect errors
> fileredirects stdout to file
1> fileredirects stdout to file
2> fileredirects stderr to file
&> fileredirects stdout and stderr to file
/dev/nullis the null device it takes any input you want and throws it away. It can be used to suppress any output.
To see the difference between stdin, stdout, and stderr => just use wikipedia!