The curl command is used to transfer data to or from a remote server. With the help of the curl command-line tool, you can upload and download data using different network protocols, such as HTTPS, HTTP, SFTP, Telnet, and FTP.
Most of the time, when you are trying to download a file through the curl command, you get an error message saying the curl command is not found. Here, you need to install the curl package on your CentOS or any other Linux distribution.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related cURL queries.
In this context, we shall look into how to install the curl command on CentOS 8 system. Also, you will learn how curl command works on CentOS or Linux machines.
How to Install Curl packages on CentOS ?
The curl command can be installed directly from the default CentOS 8 packages repository. Open the terminal from the left sidebar of the 'Activities' section and update the system cache by running the following command:
$ sudo dnf makecache
Once the repository is updated, issue the following command to install the curl packages on your CentOS 8 system. If curl is not installed then, all curl packages will be installed from the CentOS 8 repository.
$ sudo dnf install curl
After Installation process is completed, Verify the curl installation by typing the following command in the terminal:
You can Display the installed version of the curl command by using the following command:
$ curl --version
How to Use curl command on Linux system ?
The curl command is a very useful command-line utility. Using the curl command, you can view the source code of a given URL in a standard output format as follows:
$ curl https://linuxapt.com
To get the HTTP header details of the given URL, type the following command:
$ curl -I https://linuxapt.com
Using the curl command, you can download a file from a given URL and use option -o in lowercase to save a file with a name. Use the following command syntax to download a file through the curl command:
$ curl -o newfile-name.zip http://domain.com/filename.zip
Use the uppercase -O to save a file with its original name in your system as follows:
$ curl -O http://domain.com/filename.zip
Through the curl command, you can also access the password-protected files from the FTP server using the -u option. For this purpose, use the following syntax:
$ curl -u FTP_user-name:FTP_password ftp://ftp.domain.com/filename.zip
[Need assistance in fixing Linux System cURL issues ? We can help you. ]