To download a file using curl
on the Linux or Unix command line, use the curl
command followed by the URL of the file you want to download. For example:
curl https://example.com/path/to/file.zip
This will download the file and display its contents in the terminal. To save the file to a specific location on your system, use the -o
option followed by the desired file path:
curl -o /path/to/save/file.zip https://example.com/path/to/file.zip
You can also specify a different name for the saved file using the -O
option:
curl -O https://example.com/path/to/file.zip
This will save the file using its original name (in this case, file.zip
).
You can use the -L
option to follow redirects if the URL you are downloading from redirects to another URL.
curl -L -o /path/to/save/file.zip https://example.com/path/to/file.zip
You can also use the --progress-bar
option to display a progress bar while the file is being downloaded:
curl --progress-bar -o /path/to/save/file.zip https://example.com/path/to/file.zip
You can use the --limit-rate
option to limit the download speed to a specific rate (in bytes per second). For example, to limit the download speed to 1 MB/s:
curl --limit-rate 1000K -o /path/to/save/file.zip https://example.com/path/to/file.zip
These are just a few of the options available with curl
. You can use the curl
command followed by --help
to see a full list of options.