# cURL: The Swiss Army Knife of the Internet

Reference taken from: [https://everything.curl.dev/](https://everything.curl.dev/)

## The Entry Point: Why cURL?

Browsers are black boxes that hide the raw conversation between the client and the server. Browsers request the server and wait for a response. Once it gets the response, returns it to the client.  
cURL comes to the rescue; it is a lightweight tool to check the complete track of the request from the browser to the server and the returned response. cUrl stands for **Client for URL**. It behaves just like a “Postman” in your terminal; you send a request to the terminal, and cURL brings back the raw package.

## The Basic Fetch (GET)

Suppose you want to check whether a website is successfully deployed or not, you can cURL a simple GET command to the domain, which will fetch and dump the complete HTML of the website to your terminal.  
Run `curl` [`https://example.com`](https://example.com) to dump the HTML directly into your terminal.  

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768812459915/e7fdb86d-180a-433c-803d-e7fd894a6c65.gif align="center")

Few more exciting commands includes:  
`curl ascii.live/forrest` :- Create a illusion of a man running  

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768812554366/0eb014a9-7252-47be-9ffc-2a5b52e11c2e.gif align="center")

`curl` [`wttr.in`](http://wttr.in) :- Give the weather update of your current location  

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768812611654/4f4bf8fb-a630-4a42-b955-d244a25edc98.gif align="center")

## Deep-Dive Debugging (Headers)

When something in the backend goes down, your application shows a blank page or a loading animation. You are unclear about what went wrong: did your server break, the logic break, or was it a Cloudflare issue?  
Use cURL to inspect **HTTP Headers**—the hidden exchange of information (status codes, content types, and server metadata) that happens before the data arrives.  
Use `curl -I` [`https://`](https://api.example.com)`www.boxfarming.in` to fetch *only* the headers; this tells you if the server is healthy (`200 OK`) or missing (`404 Not Found`) without downloading the whole page.  

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768821939336/49d36fed-441a-48d1-873b-47ddd4c552fc.gif align="center")

**The "X-Ray" Mode:** Use the `-v` (verbose) flag to see the entire handshake, including SSL certificates and the exact request your machine sent.  

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768822070826/385e55b8-c9ba-4aaf-948b-f5a558ee7c7f.gif align="center")

**Few Flags :-**

| **Flag** | **Name** | **The "Tool" Analogy** | **What it does** |
| --- | --- | --- | --- |
| `-I` | **Head** | The X-Ray | Fetches only the **Headers** (Status codes, server info) without the body. |
| `-v` | **Verbose** | The Microscope | Shows the entire "conversation" (handshake, request, and response). |
| `-L` | **Location** | The Bloodhound | Automatically follows **Redirects** if the URL has moved. |
| `-o` | **Output** | The File Cabinet | Saves the server's response into a **local file** instead of printing to terminal. |
| `-d` | **Data** | The Envelope | Sends specific **Data** to the server (used primarily with POST). |
| `-H` | **Header** | The ID Badge | Adds extra information to your request (like **API Keys** or Content-Type). |
| `-k` | **Insecure** | The Master Key | Allows connections to local/dev servers with **unverified SSL** certificates. |
