Skip to content

How to fix Curl command not found on Linux?

  • by
  • 3 min read

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.

curl https://candid.technology/

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 https://yadullah.orgfree.com/index.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 https://candid.technology/

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

Also read: How to fix โ€˜Sudo command not foundโ€™ error on Linux?

nv-author-image

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: [email protected].

>