Skip to content

How to fix Curl command not found on Linux?

One of the best things about Linux is the ease of carrying out complex commands. All you need to do is type the right command in the terminal, and you’re good to go. 

In this article, we’re taking a look at the “curl command not found” error you might run into when using Curl.

Installing Curl on Linux

Curl is a command-line tool to transfer files from a remote server back to your local machine. If you’re seeing a “curl command not found” error when using it, chances are you haven’t installed Curl yet.

Follow these steps to get Curl up and running on your Linux distro.

Step 1: Open a terminal and type the following command.

sudo apt update

Step 2: Once the command mentioned above has finished running, install Curl using the following command.

sudo apt install curl

Now, wait for the command to execute successfully, and you should have curl installed on your Linux machine. You can verify the installation by typing curl in the terminal and monitoring the output, which should be something like this.

curl: try 'curl --help' or 'curl --manual' for more information

Also read: How to access command line history on Linux?

Using Curl

Using Curl is just as easy as downloading it. Here are a few use cases for your reference

Printing source of a file in the terminal

If you want to see the source of a remote file in your terminal, type in the command followed by the URL of the file.


As you can see, this will print the source of our homepage right inside your terminal.

Downloading files

If you’re looking to download files with Curl, you need to use either the -o or -O flag. The lowercase flag allows you to specify a file name for the download, while the uppercase flag downloads the file with the original file name.

curl -o main.php

The command mentioned above will download the index.php file from the given domain and save it as main.php. 

Fetching HTTP headers

You can also fetch only the HTTP headers of a specific URL using the -I flag. Check out the following command.

curl -I

This will print all headers from the domain into your terminal.

Also read: How to fix ‘Sudo command not found’ error on Linux?

Hello There!

If you like what you read, please support our publication by sharing it with your friends, family and colleagues. We're an ad-supported publication. So, if you're running an Adblocker, we humbly request you to whitelist us.