curl 🌐

Makes requests in various protocols, including (but not limited to) HTTP/HTTPS/FTP/FTPS.

Add a custom header to request -H

curl -H 'user-agent: curl'

ℹ️ You can set any number of headers by repeating -H options.

Make a POST request with JSON body -d & -X

curl \
    -X POST \
    -H 'content-type: application/json' \
    -d '{"key":"value"}'
  "args": {},
  "data": {
    "key": "value"
  "files": {},
  "form": {},
  "headers": {
    "x-forwarded-proto": "https",
    "x-forwarded-port": "443",
    "host": "",
    "x-amzn-trace-id": "Root=1-61ba2f8f-304430e917ea20e7024a87c3",
    "content-length": "15",
    "user-agent": "curl/7.74.0",
    "accept": "*/*",
    "content-type": "application/json"
  "json": {
    "key": "value"
  "url": ""

Read request body from file -d@

curl \
    -X POST \
    -H 'content-type: application/json' \
    -d @data-file.json

Read request headers from file -H@

curl \
    -X POST \
    -H @headers-file.txt \
    -d @data-file.json

⚠️ The headers file should be formatted as “key: value” per line.

Make a HEAD request -I

curl -I

ℹ️ Alternatively, you can use -X HEAD instead of -I.

See more detailed process logs -v

curl -v

This will print more low-level details, including protocol handshakes and negotiations.

About Living in the Shell
Obsessed with doing things in the shell, I’ve decided to share my daily struggles on living in the shell as terse but informative posts.