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
OR
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
Conclusion

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!

Two small things before you go

If something didn’t work on your setup, leave a comment and tell me which distro and version you’re on. I read every one, and most of these articles got better because a reader pointed out what was missing.

And if it did work, share it. TecMint has stayed free for 14 years because people pass these articles around, and that traffic is what pays for writing the next one.

Leave a comment
Get two free Linux courses

Learn the Linux basics with two free courses and join 34,000+ readers getting practical TecMint tutorials and selected Pro TecMint articles every week.

Pro TecMint
Get lifetime access for $99

If you want to go beyond the free tutorials, Pro gives you 18 courses, 5 ebooks, and every future course I add. One payment, lifetime access, no renewals.

Ravi Saive
Ravi Saive
Administrator
About the author

I'm Ravi Saive, an award-winning entrepreneur and founder of several successful 5-figure online businesses, including TecMint.com, GeeksMint.com, UbuntuMint.com, and the premium learning hub Pro.Tecmint.com.

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.