There might be cases where you are testing your network and it would be useful to know if your ping command is working without having to keep an eye on your screen. Imagine being in a server room behind a switch, while your computer is somewhere else in the room: it would be great if you could hear some sound while ping is working, and no sound when ping stops working (so you know when you have disconnected the correct cable).

The ping command on Linux system has a -a option that does exactly this:

ping -a 8.8.8.8

If you are on other Unix systems, the -a option is not available, so you have to use a workaround. You can use the tr command to replace every occurrence of a specific character with a sound (in this case, Ctrl+G). Go ahead, try pressing Ctrl+G now and you will see what I am talking about. The character we are going to replace is “:”, because that’s the one that always appears in the ping output when ping is successful:

ping 8.8.8.8 | tr : ^G

To make the ^G character correctly appear in your terminal, you will have to press Ctrl+V before Ctrl+G, like this:

ping 8.8.8.8 | tr : Ctrl+V Ctrl+G

And you will now have an audible ping while you roam around the server room ;)