How to download files using Curl

cURL (Client URL), pronounced "curl," is a program for transfering data (upload/download) via DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP.

Syntax

curl [url] -o [filename]

-[url] -- The location of the file or web server you want to request. (You can provide only a domain name and cURL will download the index.html file.) --o -- (optional) A flag that indicated where the output/data should be stored. -[filename] -- The filename/filepath to be used for the file cURL will create.

Example #1 -- Save File

curl http://example.com/pic.png -o whatever.png

Example #2 -- Display Data

This will display the data/HTML in your Bash/terminal.

curl http://example.com/index.html

Documentation

  • https://curl.haxx.se/docs/manpage.html