On Ubuntu 24.04 and other Linux distributions, there are different ways to download any data from a website or check any URL. There are two popular ways to download the data: directly visiting the respective website and using any command line utility along with the URL.
The cURL is one of the popular utilities used in Ubuntu 24.04 for enabling communication over web or application servers by specifying a relevant URL and data to be sent or received. To use cURL On Ubuntu 24.04 it is needed to be installed and this guide will discuss both in detail.
Outline:
How to install cURL on Ubuntu 24.04
The client URL or cURL is powered by libcurl which is a portable client-side URL transfer library. It can be used for data transfer, testing endpoints, error logging, and rate limiting. To install cURL on Ubuntu 24.04 there are three ways:
Through Ubuntu Default Package Installer
The easiest way to install client URL on Ubuntu is by using its default package installer and for that execute:
To verify the installation, check the version of cURL installed:
Through Snap Package Manager
Another way to install cURL on Ubuntu 24.04 is by using the Snap package installer so to install cURL execute:
Now to verify the cURL installation list down all the applications installed via the snap package installer:
Through Tar File
Most of the time the default package installer has the older version of the application, and even sometimes this is true in the case of third-party package installers. So in that case to get your hands on the latest version you can download the source file from the app’s official website. However, in the case of cURL their no version difference but you can try this method if others are not working. To download the source file for cURL visit its official download page:
Or copy the download link and download its tar file via the wget utility:
After downloading the file, extract it to the desired directory
Now navigate to the extracted file directory of cURL and execute the ./configure file to check for dependencies for make file generation and configure compilation configuration:
./configure
You might receive an error while the configuration file execution is related to the TLS backend selection. TLS is a security technology for establishing an encrypted link between the web server and a client:
You also may receive an error of missing libpsl library error which handles the public suffix list:
To fix the missing library error you need to first install it using apt:
Now execute the configuration file again along with selecting the suitable option for the TSL backend, here I have selected OpenSSL:
Now compile the configuration files using the make command:
Now install cURL by installing the make file created as a result of compilation:
To verify the installation of cURL on Ubuntu 24.04 check its version:
How to Use curl on Ubuntu 24.04
The client URL or cURL utility is primarily used for bidirectional data transfer that supports different protocols which include HTTP, HTTPS, FTP, and SCP. Similarly, using the cURL one can check the data of any specific website, and not only that it also provides various options for downloading or uploading any file. So here is the basic syntax for using the cURL utility:
1: Retrieving Basic URL Information
One of the basic uses of client URL utility is fetching information about any URL and for that usually the I flag is used. By using this flag HTTP response headers are fetched which include URL information about its server, content type, and more. This information is useful for debugging, monitoring or understanding how a server responds to requests:
Here, for demonstration, I have fetched the HTTP response headers for Google:
2: Exploring URL Homepage Content
If you are looking to fix certain bugs or trying to do customizations on the website through its HTML code, then you can use the cURL command to retrieve the page content of the respective website:
Here again, for the demonstration I have fetched the HTML code for Google home page:
3: Limiting File Download Rate
As mentioned above, the cURL utility is used for data transfer, which includes downloading the files. The client URL comes with a limit-rate flag through which the desired download rate for the file can be set.
Here to illustrate the use of the above-given syntax, I have limited the download rate to 500 KBs for downloading the Node.js tar file. This option comes into play when you are downloading multiple files in parallel and want to distribute the download rate equally among all.
4: Downloading Files using cURL
The one of most used features of cURL is downloading files from URLs, and different options can be used while downloading files. Primarily, there are two major flags differentiated by their cases, you can set the desired name of the file to be downloaded using the o alphabet in lower case:
Here, to further make the syntax more understandable, I have downloaded the Node.js tar file and named be file nodejs.tar.gz. This option proves to be helpful when either the default name is long enough or is difficult to identify:
Next, if you want to save the file with its default name then use the o in upper case as in the syntax below:
5: Resuming Pause Download
Sometimes while downloading files you might encounter any interruption, i.e., any network relevant or the system error. Here my Node.js wasn’t downloaded completely due to the network issue, you can verify by the amount of space used by the file:
To resume the download use the c flag along with the URL link for the file:
Further, if you need help regarding some basic options that this utility provides consult its help:
Moreover, to have more detailed help about the commands along with their usage then client URL comes with a manual:
Conclusion
To install cURL On Ubuntu 24.04 there are three ways includes: using the Ubuntu default package installer, Snap package manager, and through its deb file. The recommended way to install client URL on Ubuntu is by using its default package manager as all of the other methods also come with the same version.
The cURL is primarily used for downloading files using their download links but it can also be used for fetching the HTML codes of websites along with some basic information about the site. All you have to do is use appropriate options along the curl command.
I’m Aaliyan javaid, an electrical engineer and a passionate tech enthusiast. I have been working with embedded systems, programming, and Linux operating systems for over 2 years. I love to explore new technologies and share my knowledge and experience with others.