The curl command is a powerful, open-source command-line tool used for transferring data to or from a server using URL syntax. It supports numerous protocols (including HTTP, HTTPS, FTP, and SCP) and is widely used for fetching web content, testing API (Application Programming Interfaces), and automating web tasks.

curl has over two hundred options. Here are some of the most frequently used ones:

-o filename / —output filename Saves the output to a specified local file name. Example: curl -o page.html https://example.com -O / —remote-name: Saves the output to a local file using the same filename as the remote URL. Example: curl -O https://example.com/image.jpg -I / —head: Fetches only the HTTP headers (performs an HTTP HEAD request). Example: curl -I https://example.com -L / —location Follows any HTTP server redirects (e.g., 301, 302). By default, curl does not follow redirects. Example: curl -L https://example.com/redirect-link -d data / —data data Sends the specified data in a POST request. The data is sent using the application/x-www-form-urlencoded content type by default. Example (submitting form data): curl -d “name=John&text=test” https://example.com/submit Example (sending JSON): curl -H “Content-Type: application/json” -d ’{“key”:“value”}’ https://api.example.com/data -u user:password / —user user:password Specifies the username and password for server authentication (uses Basic authentication by default). Example: curl -u username:password https://protected.example.com -v / —verbose Displays detailed information about the operation, including the connection process, headers, and any data received, which is useful for debugging. Example: curl -v https://example.com -s / —silent Silent mode. Suppresses the progress meter and error messages. Example: curl -s https://example.com -T filename / —upload-file filename Transfers (uploads) a local file to the specified remote URL (often used with FTP or SFTP). Example: curl -T myfile.txt ftp://ftp.example.com/upload/ #clitool tool