Curl is a command-line utility for Linux, Windows, and Mac that provides basic URL handling and file transfer capabilities. Curl supports the following protocols: FTP, FTPS, HTTP, HTTPS, TFTP, SCP, SFTP, Telnet, DICT, LDAP, POP3, IMAP, and SMTP. Curl is great for mimicking user actions on pages, testing APIs, and other URL operations, have built-in support for SSL, proxies, certificate validation, HTTP cookies, and user authentication.
What is a flag in Curl?
A flag is a command-line parameter that denotes a specific action in Curl. Curl has over three hundred command-line options, and the number of options increases over time. You can add the listed flags to the Curl command and enter the URL. Flags can be short (like o, -L, etc.) or extended (like --verbose). Flags are available with single or double dashes.
How can I see the list of parameters in Curl?
To determine which parameters you need to use as a specific action, you can force Curl to enumerate them. First, the Curl --help or -h command will give you a list of the most important and commonly used options. Use curl -h [category] to list all existing types, or curl -h [all] to list all available options. Curl can combine commands by adding the listed flags and entering the URL.
List of all Curl commands
curl -h [category]
All available Curl parameters
curl -h [all]
20 most popular Curl flags for everyday use
Not all Curl parameters are shown in this table, but some of them you will use in your projects.
Download the file and save it under the original name
curl -O [URL]
Download the file and save it with a different name
curl -o [file name] [URL]
Specify the HTTP method to be used when sending the request
Resume an interrupted or intentionally stopped download
curl -C [OFFSET] -O [URL]
Curl is a powerful command-line tool compatible with almost all operating systems and connected devices. Curl is helpful for API testing, has detailed information about what was sent/received to the server, and has good error logging. Only the basic flags are shown in the article as they offer many more options. When you're done practicing the command line flags described in this tutorial, you can head over to the Curl man page to learn about all of the flag capabilities.