How to Fix Curl Not Found Error on Debian 11/10

While downloading something from the web using your Terminal, you might get an error saying “bash: curl: command not found”. The only reason why you are getting this error is that you have removed curl packages from your system by mistake.

We are going to show you how you can overcome an error of the command curl not found in the simplest manner but before that let’s clear some basics on what is curl and why it is so popular

What is Curl?

cURL stands for client URL, widely known as curl which is a free command-line tool that helps users to send and receive data from servers. The major reason why curl is so popular is that you can accomplish complex tasks such as user authentication, FTP uploads, HTTP post, proxy, and much more.

Curl is also helpful to accomplish simple tasks such as downloading web pages, images, and files.

The major question which every Linux user has on curl is why they should use it? Curl is best when you want to handle complex operations because it is scriptable. Yes, you can use wget which provides similar functions but is limited to simple usage.

Wget is easier to understand compared to curl but if you want to accomplish complex operations, there is no better command line tool than curl. So let’s start our tutorial on how you can fix curl not found.

Installing Curl on Debian 11/10

After discussing the importance of curl, we can proceed with how you can install curl. We are going to guide you through simple steps so that you can easily fix this error.

Step 1: System Update

As curl is already available in Debian’s default repository, we are not required to add any additional repository or GPG keys for authentication but we have to update all the system repositories and download updates if any.

You can easily update your repositories and download updates by single given command:

sudo apt update && sudo apt upgrade -y

1. sudo apt update && sudo apt upgrade -y

Step 2: Install Curl

Once we are done with updating repositories and downloading updates, we can now proceed with the installation part of the curl. Utilize the following command to install curl on your Debian system:

sudo apt install curl

 

2. sudo apt install curl

Step 3: Verifying Installed Package

Verifying the installed package is crucial in every installation because sometimes packages might not be installed due to some internal error such as repository. To check whether we have successfully installed curl on our system, use the following command:

curl --version

3. curl --version

If it shows you output with version number and other details, you have successfully installed curl to your system.

Using Curl

Curl has more than two hundred operations but to make things simple, we are going to discuss basic curl operations, how to download the source code of the website, and download files from the web. So let’s start with basic curl operations.

1. -I for Returning HTTPS Headers only

If you want to get headers of any website, you have to use -the I option with curl. It will return you header fields such as Date, Content-Type, Connection, etc.

curl --request GET 'https://api.nasa.gov/planetary/apod?api_key=<myapikey>&date=2020-01-01' -I

4. curl -I

2. -v for Getting Output of Behind the Scenes

The -v is a short form of verbose. Verbose is used when you want to know everything in detail from running a curl command to connection and headers. In the given command we have shown you getting an image with its description along with the image URL.

curl --request GET 'https://api.nasa.gov/planetary/apod?api_key=$NASA_API_KEY&date=2020-01-01' -v

5. curl -V

3. -o for Storing Output Files

If you are interested in storing files using curl, you have to use the -o option with curl and it will store required files.

curl --request GET 'https://api.nasa.gov/planetary/apod?api_key=$NASA_API_KEY&date=2020-01-01' --output curloutput

6. curl -o

You can easily cross-check whether the files have been saved or not by listing all the available files in the directory. Use the following command to list all the files and folders in the current directory.

ls

6.1 ls

You can see the file named curloutput has been saved in our Home directory.

4. Showing Source Code of Websites

You can use curl to get the source code of any required website. In the source code, you will find the code and its structure. You can also see the logic behind the website if the admin has allowed it. In the given code, we have shown the source code of our website.

If you want to see the source code of any other website, you can easily change our website’s URL with your required one.

curl https://geniusgeeks.com

7. curl geniusgeeks.com

5. Resuming Downloads

We have already shown you how you can save files but what about resuming them? If you are downloading large files and your downloading stops due to poor connection, you can easily resume it by the following command:

Suppose, you are downloading Ubuntu 18.04 using curl by given command:

curl -O https://releases.ubuntu.com/20.04.4/ubuntu-20.04.4-desktop-amd64.iso?_ga=2.235867265.1480235474.1647524965-1875399119.1647524965

8.1 downloading ubuntu 20.04

And it is been paused due to a network issue so you can easily resume it by the given command:

curl -C - -O https://releases.ubuntu.com/20.04.4/ubuntu-20.04.4-desktop-amd64.iso?_ga=2.235867265.1480235474.1647524965-1875399119.1647524965

8.2 resuming downloads

Frequently asked questions related to curl

What does cURL actually do?

cURL helps you to accomplish complex tasks such as user authentication, FTP uploads, HTTP post, proxy, and much more.

What is curl command Linux?

cURL stands for client URL which is normally used to download files from the web. You can also extend its functionality as its scriptable.

Wrapping up

Curl is one of the most useful command-line utilities which can help use APIs. If you are geeing error curl not found, you can easily solve that issue by given steps.

Sagar Sharma
Sagar Sharma

Sagar always uses Linux to its core and loves to write the technical side of system administration! While he's not writing for GeniusGeeks, you can find him writing for core linux blogs like IT'SFOSS.com and LinuxHandBook.com

Articles: 54