How to Fix “bash: curl: command not found” Error

If you’re a Linux user and you’ve ever encountered the error message “bash: curl: command not found” or “bash: /usr/bin/curl: No such file or directory” don’t worry – you’re not alone! This error often pops up when you try to use the curl command in the terminal, but the system can’t find it.

In this tutorial, you will learn what this error means, and how to install the curl command across all major Linux distributions to fix it.

Understanding “bash: curl: command not found” Error

Firstly, let’s understand that ‘curl‘ is a command-line tool used to transfer data to or from a server, making it a handy tool for downloading files, making requests to APIs, and more.

However, if your system doesn’t recognize the ‘curl‘ command, you’ll see the error message such as:

bash: curl: command not found
bash: /usr/bin/curl: No such file or directory

The most common reason for this error is that ‘curl‘ is not installed on your Linux system. Unlike some other commands that come pre-installed, ‘curl‘ might need to be installed separately.

Installing curl in Linux

To install curl on Linux, use the following appropriate command for your specific Linux distribution.

sudo apt install curl         [On Debian, Ubuntu and Mint]
sudo yum install curl         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
sudo emerge -a sys-apps/curl  [On Gentoo Linux]
sudo apk add curl             [On Alpine Linux]
sudo pacman -S curl           [On Arch Linux]
sudo zypper install curl      [On OpenSUSE]    
sudo pkg install curl         [On FreeBSD]

Once curl isntalled, you can verify the version by running the following command on your terminal.

curl --version
Install Curl in Linux
Install Curl in Linux

If ‘curl‘ is installed but still not recognized, it might not be in your system’s PATH. The PATH is a list of directories where the system looks for executable files.

You can check if ‘curl‘ is in the PATH by typing.

echo $PATH

If ‘curl‘ is not in the list, you can add it manually. Find the path where ‘curl‘ is installed by running the following command.

which curl

and add it to the PATH in your shell profile file (like ‘.bashrc‘ or ‘.bash_profile‘).

export PATH=$PATH:/usr/bin/curl

Don’t forget to restart your terminal or run the following command to apply the changes.

source ~/.bashrc
Set Curl Path
Set Curl Path

Encountering the “bash: curl: command not found” error is a common problem for Linux users, but it’s easily solvable by either installing ‘curl‘ or ensuring that it’s in your system’s PATH.

Linux provides flexibility and customization, and understanding how to troubleshoot such issues empowers users to make the most of their systems. So, next time you see this error, fear not – you’ve got the tools to fix it!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.