How to Install and Use Curl on Debian 12

Curl is the abbreviation of the “Client-URL” and a command-line utility to deal with URLs. In today’s era, the whole world is linked with websites for their business and marketing. To deal with these websites, different protocols including HTTP, HTTPS, and FTP are used for sending and receiving information. 

The curl command utility can be installed on Debian 12 by following the steps explained in this article. The basic usage of the curl command utility on Debian 12 has also been demonstrated with simple examples. 

What is the Method to Install Curl on Debian 12?

The most convenient method for installing the Curl is by using the available package in Debian’s 12 default repository. 

First, ensure the packages of Debian 12 are up to date:

$ sudo apt update

Now, install the curl command utility:

$ sudo apt install curl -y

When the installation is completed, verify the installation by displaying the version of the installed curl:

$ curl --version

This shows that the curl command has been successfully installed. 

What is the General Syntax of the Curl Command Utility?

On Debian 12, the curl command’s default usage syntax is:

$ curl [Options] [URL]

Use the “curl” to revoke the command. Use any option of the “curl” to perform a particular operation on the provided URL. 

To explore the options of the curl command, use its manual with the command:

$ man curl

What is the Basic Usage of the Curl on Debian 12?

Different basic commands of the Curl command utility have been explained with examples.

Fetch the Web-page Information

To fetch the information of the web page, simply specified the URL of the webpage:

$ curl https://google.com

This command has displayed the HTML content of the provided webpage. 

Download a File

The curl command on Debian 12 can also be used to download the file from the website. For example, we will download the Debian package of Java:

$ curl -O https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.deb

The “O” option of the curl command tells it to save the file in the current directory. 

Add the GPG Key

Also, the curl command can be used to add the GPG key of the packages to the Debian repository. For example, the GPG key of the NodeJS package has been added with the curl command:

$ sudo curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -

Display the Headers of the URL

To display the headers of the URL, use the “I” option of the curl command:

$ curl -I https://www.google.com

How to Uninstall Curl on Debian 12?

To uninstall and remove the curl package with its all associated file, use the “purge” option of the apt package manager:

$ sudo apt purge curl -y

This is all about the installation and usage of the curl command utility on Debian 12. 

Conclusion

To install the curl command utility on Debian 12, execute the command “sudo apt install curl -y”. It can be used by following the “curl [options] [url]” syntax. This post explains the installation and installation methods of the curl command utility on Debian 12. Also, simple examples are used to demonstrate the basic usage of the curl command.