Ping specific web addresses?

I'm making a bash script to ping a certain web address. The problem is, when I say:
ping then ping says
ping: Name or service not known
Can somebody please help me with this? What is a program that I can use to ping an https server.
I have to have the slashes there because I want to ping that certain page.
Thank you in advance.

4

2 Answers

You can use httping:

httping 

If you want to check if your word exists, you need to specify, that only Status 200 is OK.

httping -m -o 200 

And maybe add -c 1 to exit after 1 probe and -l to avoid the Info message that SSL was auto enabled.

Output:

$ httping -l -m -o 200 -c1
69,734001
$ httping -l -m -o 200 -c 1
-1

Install via

sudo apt install httping

Alternative, if httping is not available, of course it is possible with curl to print the status code of a request only.

$ curl -s -o /dev/null -w "%{http_code}\n"
200
$ curl -s -o /dev/null -w "%{http_code}\n"
301
0

Ping only understands hostnames and ip-addresses. So in your example it should be:

ping 

But even this isn't sure to work, because icmp packets (which ping is a part of) might be blocked in router or firewalls along the way to the destination.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like