---
name: curl
description: HTTP client examples including download, POST, auth, JSON, headers, proxy, and FTP operations.
title: curl
canonical_url: https://skilld.dev/gh/jyasuu/cheat-sheet/curl
last_updated: 2026-10-06T17:16:37.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install jyasuu/cheat-sheet/curl`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/curl`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/jyasuu/cheat-sheet/curl) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/curl`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/curl --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/curl --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# curl — Handy Examples

**Download Files**

```bash
# Download a file and save with original filename
curl -O http://example.com/file.txt

# Download a file with specific name
curl -o filename.ext http://example.com/file.txt

# Download and limit speed
curl --limit-rate 100K -O http://example.com/largefile.zip

# Resume interrupted download
curl -C - -O http://example.com/largefile.zip

# Download multiple files
curl -O http://example.com/file1.txt -O http://example.com/file2.txt

# Download all sequentially numbered files (1-24)
curl http://example.com/pic[1-24].jpg
```

**HTTP Methods & Data**

```bash
# POST data
curl -d "name=value" http://example.com/resource

# POST JSON data
curl -H "Content-Type: application/json" -d '{"key":"value"}' http://example.com/resource

# Send URL-encoded data
curl --data-urlencode "key=value" http://example.com/resource

# Custom HTTP method
curl -X PUT http://example.com/resource
curl -X DELETE http://example.com/resource
```

**Headers & Authentication**

```bash
# Include headers in output
curl -i http://example.com

# Show only HTTP headers
curl -I http://example.com

# Custom header
curl -H "Custom-Header: Value" http://example.com

# Basic authentication
curl -u username:password http://example.com

# Save response headers to file
curl -D headers.txt http://example.com
```

**Proxy & Advanced**

```bash
# Use proxy
curl -x http://proxy-server:port http://example.com

# Get HTTP status code only
curl -o /dev/null -w '%{http_code}\n' -s -I URL

# Get external IP as JSON
curl http://ifconfig.me/all.json

# Follow redirects
curl -L http://example.com

# Download and pipe to grep
curl http://example.com/file.txt | grep "search-string"
```

**FTP Operations**

```bash
# Upload file via FTP
curl -T localfile.txt ftp://ftp.example.com/upload/

# Download via FTP with auth
curl -u username:password -O ftp://example.com/pub/file.zip

# List FTP directory
curl ftp://username:password@example.com
```

**Original Examples**

```bash
curl --resolve example.com:443:127.0.0.1 https://example.com
curl --output example.html "https://example.com/"
curl --header "PRIVATE-TOKEN: ?" https://example.com/
curl --basic --user 'test:test' https://example.com/
curl -fsSL https://example.com/install.sh | sh
curl --ftp-ssl --user "test:test" -l sftp://example.com:22/ --key ./id_rsa --pubkey ./id_rsa.pub
curl --request POST --data "A=B&C=D" https://example.com
curl --request POST --form "A=B" --form "C=D" https://example.com
curl --upload-file test.txt https://example.com
curl --ftp-ssl --user test:test -l ftp://example.com:21
```