linuxbashnohupdev-null

nohup command & : How to discard output?


I am running this command :

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

After I run it I get this output :

[1] 16975

Is there anyway that I can run that command and get no output at all?

Thanks in advance!


Solution

  • You could use &> to redirect both stdout and stderr like so:

    nohup google-chrome &> /dev/null &
    

    To hide the pid use a subshell:

    (nohup google-chrome & ) &> /dev/null