mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 15:18:01 +00:00
822 B
822 B
Download A File With Curl
Though I typically think of cURL as a way of hitting an API endpoint to check
its headers or see what it returns, it can also be used as an alternative to
wget to download a file.
With the -O option (short for --remote-name) we instruct cURL to save the
contents of the remote file to a local file in the current directory using the
same name as the remote.
Here is an example:
$ curl -O https://www.apache.org/dist/db/derby/db-derby-10.17.1.0/db-derby-10.17.1.0-bin.zip.asc
This creates a file in my current directory called
db-derby-10.17.1.0-bin.zip.asc. Notice it only uses the last part of the path
for the file name.
See man curl for more details.