1

Why can I write the command

ping www.google.com

but not

ping www.google.com/

or

ping http://www.google.com

The latter two yield an "unknown host" error.

2 Answers 2

1

Ping is used to tell if a host (hostname or IP address) is alive. It uses the ICMP protocol to do so. It does not know anything about URLs or web servers.

What you probably want is a http ping utility, like http-ping. Or you can use tools like curl, or wget to retrieve website index pages and measure the latency that way.

Example with curl (this does a HEAD request):

$ time curl -I http://www.cnn.com >/dev/null

real    0m0.242s    <== 242 milliseconds
user    0m0.015s
sys     0m0.016s

Example with curl for GET request:

$ time curl http://www.cnn.com >/dev/null

real    0m0.783s    <== 783 milliseconds
user    0m0.031s
sys     0m0.030s

This will give you a crude idea of how responsive the web server is from your host.

1

Because ping works with IP addresses or hostnames (resolves to IP for you).

www.google.com is a host, but www.google.com/ and http://www.google.com are urls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.