How to ping the Internet on Ubuntu?

I need to ping Google to see my Internet status. In Windows we use:

ping -t [websitename]

In the run menu. How do I do this on Ubuntu?


As far as I know, on Windows by default ping somesite.net will send 4 ICMP echo request packets to the somesite.net. As you have used the -t option i.e. ping -t somesite.net, this will run indefinitely on Windows i.e. it will keep on sending ICMP echo request packets until you quit it yourself.

On Ubuntu ping soemsite.net will run indefinitely i.e. it is same as ping -t soemsite.net for Windows. On the other hand if you want to send a certain number of packets you can use the -c option. E.g., to send 4 ICMP echo request packets you need to open the Terminal with Ctrl+Alt+T and run:

ping -c 4 somesite.net

Also any packet ping sends is highly configurable on Ubuntu. Check man ping to get more ideas.


Please open a terminal Ctrl+Alt+T. Enter:

ping -c3 www.google.com

If you get ping returns, then you are connected. For example:

--- www.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 20.697/21.033/21.260/0.294 ms

chili555's answer already covers the question, however if you're trying to debug a connection issue traceroute is way more verbose (you'll have to enable the Universe repository in order to install it):

sudo apt-get update && sudo apt-get install traceroute

Sample output of traceroute askubuntu.com on my machine:

ubuntu@ubuntu ~ % traceroute askubuntu.com 
traceroute to askubuntu.com (104.16.17.44), 30 hops max, 60 byte packets
 1  192.168.0.1 (192.168.0.1)  2.869 ms  3.661 ms  4.413 ms
 2  * * *
 3  0.0.0.0 (0.0.0.0)  33.405 ms  35.751 ms  37.452 ms
 4  0.0.0.0 (0.0.0.0)  42.541 ms 0.0.0.0 (0.0.0.0)  44.504 ms 0.0.0.0 (0.0.0.0)  50.297 ms
 5  0.0.0.0 (0.0.0.0)  53.278 ms 0.0.0.0 (0.0.0.0)  55.500 ms 0.0.0.0 (0.0.0.0)  57.140 ms
 6  * 0.0.0.0 (0.0.0.0)  32.867 ms  33.419 ms
 7  0.0.0.0 (0.0.0.0)  34.096 ms  35.122 ms  40.241 ms
 8  0.0.0.0 (0.0.0.0)  40.910 ms  41.986 ms  45.287 ms
 9  0.0.0.0 (0.0.0.0)  46.972 ms  47.290 ms  53.258 ms
10  104.16.17.44 (104.16.17.44)  53.822 ms  31.788 ms  33.164 ms

If you merely wish to test if your connection is working, a simple way is to use fping with example.com. fping returns 0 on success; see the manual for details on return codes.

if fping -q example.com
then
    # Connection is working.
else
    # Connection is not working.
fi