Curl

Fetch headers

curl --head "

https://example.com

"

List contents of a directory

curl --list-only "

https://example.com/foo/

"

Redirect query as specified by a 3xx response

curl --location "

https://iana.org

"

Fail quickly

curl --fail-early "

http://opensource.ga

"

Download a file, saving the file without changing its name

curl --remote-name "

https://example.com/linux-distro.iso

"

Download a file, renaming the file

curl --remote-name "

http://example.com/index.html

" --output foo.html

Continue a partial download

curl --remote-name --continue-at - "

https://example.com/linux-distro.iso

"

Download a file from multiple domains

curl "

https://www.%7Bexample,w3,iana%7D.org/index.html

" --output "file_#1.html"

Download a sequence of files

curl "

https://%7Bfoo,bar%7D.com/file_%5B1-4%5D.webp

" --output "#1_#2.webp"

Download all PNG files from a site (uses GNU grep)

curl

https://example.com

| grep --only-matching 'src="[^"]*.[png]"' | cut -d" -f2 | while read i; do curl

https://example.com/%22$%7Bi%7D

" -o "${i##*/}"; done

Check whether a website is down

curl --head --show-error "

http://example.com

"

Expand a shortened URL

curl --head --location "

https://bit.ly/2yDyS4T

"

Query an API endpoint

curl "

https://gitlab.com/api/v4/projects

"

Send raw data

curl --data "Some data" "

https://example.com/api/v4/endpoint

"

Send form data (emulates a form and Submit button)

curl --form "username=seth" --form "password=12345678" "

https://example.com/api/v4/endpoint

"

Send a file as form data

curl --form "avatar=@me.jpg" "

https://example.com/foo/bar

"

Send contents of a file as form data

curl --form "description=<file.md" "

https://example.com/foo/bar

"

Send HTTP header

curl --header "Authorization: Bearer F66eD5ffXHp2Y" "

https://example.com/api/v4/endpoint

"

Specify HTTP Method

curl --request POST --data "Foo: bar" "

https://example.com/api/endpoint

"

Make an API call to a service

curl --request PUT --header "PRIVATE-TOKEN: your_access_token_here" --data "?per_page=10" "

https://gitlab.com/api/v4/namespaces

"

Proxied content from gemini://sdf.org/klaatu/geminifiles/curl-cheatsheet.gmi (external content)

Gemini request details:

Original URL
gemini://sdf.org/klaatu/geminifiles/curl-cheatsheet.gmi
Status code
Success
Meta
text/gemini
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.