Networking

Linux curl command

Transfer data to or from a URL; -I requests response headers only.

Availability: Common Linux commands; shell built-ins and external implementations may differ by distribution.中文

Syntax

curl [OPTION]... URL...

Examples

Inspect response headers without downloading the body.

curl -I https://example.com

Save a successful response to a file and report errors.

curl -fsS https://example.com/data.json -o data.json

Parameters, options and clauses

Option / clauseDescription
-I, --headFetch response headers only.
-L, --locationFollow HTTP redirects.
-o FILE, --output FILEWrite response data to FILE.
-O, --remote-nameSave using the remote filename.
-H, --header HEADERAdd a request header.
-d, --data DATASend request data (often used for POST).
-f, --failReturn an error for HTTP error responses without outputting the error page.
-sS, --silent --show-errorHide progress while still showing errors.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory