ping6 ipv6.google.com &

After I type this in the terminal, the command is ran in the background. However, it stills generate the output to the foreground, and print the result to the terminal.

How to make it display the output in the background?


You need to redirect to the null device:

ping google.com >/dev/null

I know only two ways to solve this.

Either use the -q option on ping like this ping -q google.com which makes it only display the summary lines at startup and on exit or you redirect the output to /dev/null like this
ping google.com > /dev/null.


You might want try screen.

Just run screen in a terminal. You'll be greated by a little splash-screen with some information about screen and a copyright notice. Once you hit enter, a new shell is started "inside" screen.

Run your ping command in there, without the & behind it.

Now you can detach from the screen by hitting Ctrl+A+D. You'll be back to the shell you ran screen from. The program(s) running "inside" the screen will continue to run in the background.

To reattach to the screen, run screen -r, and you'll see the output produced by your ping command again.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy