While wget is the most commonly used utility to download files, cURL and aria2 can be used to achieve the same results as well.
cURL works both as a command line utility and a library and therefore you can use it to download and transfer any kind of data over different protocols such as HTTPS, SFTP, HTTP, FTP and many more. In this tutorial, I will show you the different use cases of this command line tool with examples, so fasten your seatbelts and let’s get started!
Also read – The Difference between Wget and cURL command
Using cURL to download a file.
Simply type the following command if you wish to download a file without any extra parameters :
If you want to specify any protocol, then you can type :
Let’s say you want to follow a 301-redirected file while downloading, you can use the -L flag :
curl -L http://a-website/sourcecode.tar.gz
You can also download a file and immediately rename it using -o flag like this :
curl -L -o file.txt http://sample-website/very.long.file.name.txt
For example, let’s download an application named Freetube from GitHub :
You can also apply a speed limit to your downloads using the –limit-rate flag. For example :
curl -L -O --limit-rate 1m https://github.com/FreeTubeApp/FreeTube/releases/download/v0.17.1-beta/freetube-0.17.1-linux-portable-arm64.zip
In the above example, I have set the download rate to not exceed 1MB per second.
cURL is a really lightweight tool full of features that any other terminal-based downloader might not have. However, to read more about its functions, you should definitely check out the manual page of this command, just type :