curl — HTTP requests from the console
cheat sheet · Ubuntu 24.04 · curl 8.5 https://lab.dimsanych.ru/en/wiki/curl/Cheat sheet
-
curl -i http://site.lab.test/code, headers, body -
curl -I http://site.lab.test/headers only (HEAD) -
curl -v -o /dev/null http://site.lab.test/the whole exchange -
curl -s -o /dev/null -w '%{http_code}\n' http://site.lab.test/ -
curl -H 'Host: docs.lab.test' http://127.0.0.1/ -
curl --resolve shop.lab.test:443:127.0.0.1 https://shop.lab.test/ -
curl --cacert ca.pem https://shop.lab.test/trust your own CA -
curl --unix-socket /run/app/app.sock http://localhost/ -
curl -X POST -H 'Content-Type: application/json' -d '{"a":1}' URL
Options
The table below lists the main options. -s hides both progress and errors;
scripts pair it with -S so errors stay visible.