How can I redirect all output to /dev/null?

Solution 1:

Redirection operators are evaluated left-to-right. You wrongly put 2>&1 first, which points 2 to the same place, as 1 currently is pointed to which is the local terminal screen, because you have not redirected 1 yet. You need to do either of the following:

2>/dev/null 1>/dev/null google-chrome &

Or

2>/dev/null 1>&2 google-chrome &

The placement of the redirect operators in relation to the command does not matter. You can put them before or after the command.

Solution 2:

In the section Redirection, Bash's reference manual says:

The operator [n]>&word is used [...] to duplicate output file descriptors

To redirect both standard error and standard output to file you should use the form

&>file

With regard to your case, that means substitute

2>&1 1>/dev/null

with

&>/dev/null