How to download files using curl
curl is a tool to transfer data from or to a server, using one of the supported protocols: HTTP, HTTPS, FTP, FTPS, SMB... (see the curl Manual for a list of supported protocols). curl also supports HTTP POST, authentication, cookies, metalinks, file downloading and more. curl is an excelent download manager because support progress bar and allows to pause/resume the download from the last downloaded byte.
Download a single file
$ curl -# -C - -O http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/x86_64/alpine-standard-3.8.0-x86_64.iso
Download the Alpine ISO to the current DIR.
Options
-#: Progress bar.
-C -: Restart the download from last downloaded byte.
-O: Save the file to the current DIR with the same remote name: alpine-standard-3.8.0-x86_64.
Download several files
Using xargs and curl (wget -I style)
$ xargs -a urls.txt -I{} curl -# -O {}
xargs reads line by line the file urls.txt and passes each line to curl, note the xargs option: -I{} and curl option: -O {}, url.txt looks like this:
https://download.libsodium.org/libsodium/releases/latest.tar.gz
https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz.sig
Using the -K option
$ curl -# -K urls.txt
urls.txt looks like:
url = "url1"
output = "nom-fich1"
url = "url2"
output = "nom-fich2"
using -K option, standard input and HEREDOC
curl -# -K - <<URL
url = "https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz"
output = "libsodium-1.0.16.tar.gz"
url = "https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz.sig"
output="libsodium-1.0.16.tar.gz.sig"
URL
Leave How to download files using curl to:
Read more #curl posts
Best Posts From srdotlibre
We have not curated any of srdotlibre's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From srdotlibre
- Instalar/configurar ProFTPD en RHEL, CentOS, Fedora
- Protege tus datos con PostgreSQL Backup
- Noticias del Software Libre – 20230423
- NVM - Administrador de versiones para NodeJS
- 6 Comandos para administrar PostgreSQL
- Richard Stallman quote about Sharing knowledge
- ¿Cómo actualizar NetBSD de una versión a otra?
- Instalando Guest Additions en VirtualBox
- Fedora 37 - Mate Desktop
- GNOME 44 - Desktop - Lo último de GNOME