Saturday, 19 July 2025

How to Test Website Availability with ping, curl, and wget

Introduction

Monitoring website availability is a crucial part of system administration, web development, and IT troubleshooting. While there are many sophisticated tools for uptime monitoring, sometimes a quick check using built-in command-line tools is all you need. In this article, we’ll show you how to use ping, curl, and wget to test if a website is up and responsive.

1. Using ping

The ping command checks if a host is reachable by sending ICMP echo requests and measuring the response time.

ping example.com

If the site is reachable, you’ll see replies with response times. Note: Some web servers or firewalls block ICMP traffic, so a failed ping doesn't always mean the site is down.

2. Using curl

curl fetches the content of a URL and is ideal for testing HTTP response codes.

curl -I https://example.com

The -I flag tells curl to fetch only the headers. A successful website usually returns HTTP/1.1 200 OK.

3. Using wget

Like curl, wget can retrieve content from web servers. It's often used for downloading files but also works well for testing availability.

wget --spider https://example.com

The --spider option checks the site’s availability without downloading the content. If the site is reachable, you'll see a “200 OK” or similar status.

Conclusion

With ping, curl, and wget, you have a powerful trio of tools for testing website availability right from your terminal. Whether you're debugging a server issue or writing a simple monitoring script, these commands are quick, effective, and always available.

No comments:

Post a Comment