Skip to main content

Command Palette

Search for a command to run...

Let's get started with cURL(beginner overview)

Published
4 min read

If you’ve ever wondered how your computer talks to a server behind the scenes, or how developers test APIs without opening a browser, this is where cURL quietly shines.

This guide is written to be beginner‑friendly, human, and confidence‑building, while still going deep enough to understand what’s really happening — not just memorise commands.


Before cURL: What Is a Server and Why Do We Talk to It?

At its core, the internet is simply computers talking to other computers.

  • Your laptop or phone is a client

  • A machine sitting somewhere in a data center is a server

When you open a website, your device sends a request:

“Hey server, I need this page or data.”

The server replies with a response:

“Here you go — and here’s the status of your request.”

Browsers hide this complexity. cURL lets you see and control it directly.


What Is cURL? (Very Simple Terms)

cURL stands for Client URL.

cURL is a command‑line tool that sends requests to servers and prints the response.

Think of it as:

  • A browser without a UI

  • A messaging tool for servers

  • A way to see raw HTTP communication


Why Programmers Use cURL

Developers love cURL because it is:

  • Fast and lightweight

  • Scriptable and automatable

  • Honest (no hidden abstractions)

  • Available everywhere

Used for:

  • API testing

  • Backend debugging

  • Learning HTTP

  • CI/CD pipelines

  • Server health checks


Your First cURL Command

curl https://example.com

What This Command Means

  • curl → run the cURL program

  • https://example.com → URL of the server

Behind the scenes:

  1. cURL sends a GET request

  2. Server returns HTML

  3. cURL prints the response


Understanding Request and Response

Request Contains

  • Method (GET, POST)

  • URL

  • Headers

  • Optional body

Response Contains

  • Status code (200, 404, 500)

  • Headers

  • Body (HTML / JSON)

cURL exposes this raw exchange.


Common cURL Commands and Options (Explained)

This section explains what you will actually use as a beginner and why.


curl <url> — Simple GET Request

curl https://api.github.com

Meaning:

  • Sends a GET request

  • Fetches data from server

  • Prints response body

Use it when you just want data.


-X — Specify HTTP Method

curl -X POST https://api.example.com/users

Meaning:

  • -X tells cURL which HTTP method to use

  • POST is used to send data

Avoid using -X GET explicitly — GET is default.


-i — Show Response Headers

curl -i https://example.com

Meaning:

  • Shows status code and headers

  • Useful for debugging

You’ll see:

HTTP/1.1 200 OK
Content-Type: text/html

-v — Verbose Mode (Debugging)

curl -v https://example.com

Meaning:

  • Shows request + response details

  • Helps debug connection issues

Think of it as “show me everything”.


-H — Add Request Headers

curl -H "Accept: application/json" https://api.example.com/users

Meaning:

  • Adds custom headers

  • Commonly used for APIs

Headers tell the server how to treat your request.


-d — Send Data (POST Body)

curl -X POST -d "name=John&age=25" https://api.example.com/users

Meaning:

  • -d sends data in request body

  • Automatically switches request to POST

Used when submitting forms or JSON.


-o — Save Output to File

curl -o page.html https://example.com

Meaning:

  • Saves response to a file

  • Prevents cluttering terminal


-I — Headers Only

curl -I https://example.com

Meaning:

  • Fetches headers only

  • Useful for quick checks


Using cURL with APIs (Realistic Example)

curl https://api.github.com/users/octocat

You receive JSON instead of HTML.

This is how:

  • Mobile apps

  • Frontends

  • Microservices

communicate with servers.


GET vs POST (Beginner Perspective)

MethodPurposeChanges Data
GETFetch dataNo
POSTSend dataYes

Common Beginner Mistakes

  1. Forgetting https://

  2. Expecting formatted output

  3. Copy‑pasting flags blindly

  4. Misunderstanding status codes


Where cURL Fits in Real Development

  • API development

  • Debugging production issues

  • DevOps automation

  • Learning networking

Many developers use cURL daily.


Final Thoughts

cURL is not about memorising flags.

It’s about understanding communication between machines.

Once this clicks, APIs, HTTP, and backend systems stop feeling mysterious — and start feeling logical.