bash: curl: command not found

Deepak Prasad
Tested on RHEL 10.2 (Coughlan)
Ubuntu 26.04 LTS (Resolute Raccoon) in a container
Package curl
Applies to RHEL, Rocky Linux, AlmaLinux, Fedora, Debian, Ubuntu, Arch Linux, openSUSE, Alpine Linux, and other distributions with a curl package
Privilege sudo or root to install packages; normal user to inspect PATH
Scope Diagnose and fix bash: curl: command not found when the curl package is missing or when PATH does not include /usr/bin or /bin. Does not cover libcurl development headers or compiling curl from source.
Related guides Install cURL on Ubuntu
Install cURL on Debian
curl command
which command
dnf command

cURL is a widely used command-line tool for transferring data over HTTP, HTTPS, FTP, and many other protocols. Install scripts, CI jobs, and admin runbooks often start with curl https://…, so the first failure you see is usually bash: curl: command not found (Ubuntu may print curl: command not found instead). That message almost always means one of two things: curl is not installed, or it is installed but your PATH cannot see it. The steps below cover both cases on common Linux distributions.


Quick answer

Situation What to do
Fresh minimal VM or container Install the curl package for your distro (table below)
rpm -q curl or dpkg -l curl shows installed Fix PATH — add /usr/bin and /bin
After install or PATH change Run curl --version and command -v curl
Need full Ubuntu or Debian install walkthrough Install cURL on Ubuntu or Install cURL on Debian

Cause 1: the curl package is not installed

Cloud images, containers, and stripped-down lab VMs often ship without curl. When the binary is missing, bash prints an error and exits with status 127.

bash
curl --version

On RHEL 10.2 without the package, or in a minimal Ubuntu 26.04 container before install:

output
bash: curl: command not found

Desktop Ubuntu may also suggest sudo apt install curl through the command-not-found helper. Container images without that package only show the bash line above.

Install curl by distribution

Pick the row for your distro. Every command uses install <package> — the package name is curl, not a positional argument to dnf or apt.

Distribution Install command
Debian, Ubuntu, Mint sudo apt install curl
RHEL 8+, Rocky, AlmaLinux, Fedora sudo dnf install curl
Older RHEL / CentOS 7 sudo yum install curl
Arch Linux sudo pacman -S curl
openSUSE Leap / Tumbleweed sudo zypper install curl
Alpine Linux sudo apk add curl

On Debian and Ubuntu, refresh indexes first when apt reports no candidate:

bash
sudo apt update

Then install:

bash
sudo apt install curl

On RHEL-family systems, dnf pulls curl from the base repository:

bash
sudo dnf install curl

I verified the Ubuntu path in a Ubuntu 26.04 container — after apt install curl, curl --version reported 8.18.0. On RHEL 10.2 the installed build is curl-8.12.1-4.el10.x86_64 at /usr/bin/curl.

For dependency errors, Snap vs apt trade-offs, and step-by-step screenshots, use the dedicated Install cURL on Ubuntu and Install cURL on Debian guides instead of repeating those procedures here.


Cause 2: curl is installed but PATH is wrong

If the package is on disk but /usr/bin or /bin is missing from PATH, the shell still cannot find curl. This often happens after a bad edit to ~/.bashrc, a minimal PATH in a cron job, or a misconfigured application profile.

Confirm the package is present on RHEL:

bash
rpm -q curl

Sample output:

output
curl-8.12.1-4.el10.x86_64

List the binary path the package owns:

bash
rpm -ql curl | grep '/curl$'

Sample output:

output
/usr/bin/curl

On Debian or Ubuntu, use dpkg -L curl | grep '/curl$' instead. The path is usually /usr/bin/curl; some older layouts also provide /bin/curl.

Check whether the shell can resolve the name:

bash
command -v curl

When PATH is healthy, that prints /usr/bin/curl. When standard directories are stripped out, it prints nothing and returns exit code 1.

Inspect the current search path:

bash
echo $PATH

A broken example might list only /usr/games:/usr/local/games and omit /usr/bin and /bin.

Reproduce the failure by running curl with that trimmed path:

bash
PATH=/usr/games:/usr/local/games curl --version

Sample output:

output
bash: curl: command not found

Add the missing standard directories for the current shell:

bash
export PATH="$PATH:/usr/bin:/bin"

Run curl again:

bash
curl --version

Sample output:

output
curl 8.12.1 (x86_64-koji-linux-gnu) libcurl/8.12.1 OpenSSL/3.5.5 zlib/1.3.1.zlib-ng brotli/1.1.0 libidn2/2.3.7 libpsl/0.21.5 libssh/0.12.0/openssl/zlib nghttp2/1.68.0 OpenLDAP/2.6.10
Release-Date: 2025-02-13

To make the fix persistent, append the same export line to ~/.bashrc (interactive bash) or ~/.bash_profile (login shells). Remove or fix any earlier line that overwrote PATH with a short list. The which command article explains how PATH order affects which binary runs when several copies exist.


Verify the fix

After installing curl or repairing PATH, confirm the binary and version:

bash
command -v curl

Sample output:

output
/usr/bin/curl

Check the installed version string:

bash
curl --version

Sample output:

output
curl 8.12.1 (x86_64-koji-linux-gnu) libcurl/8.12.1 OpenSSL/3.5.5 zlib/1.3.1.zlib-ng brotli/1.1.0 libidn2/2.3.7 libpsl/0.21.5 libssh/0.12.0/openssl/zlib nghttp2/1.68.0 OpenLDAP/2.6.10
Release-Date: 2025-02-13

A quick HTTPS HEAD request proves networking works end to end:

bash
curl -sI https://www.golinuxcloud.com/ | head -3

If curl returns HTTP response headers, the binary is installed and networking is working far enough to reach the server. A status line such as HTTP/2 200, HTTP/1.1 301, or another valid HTTP response is enough; DNS, TLS, proxy, or network errors are separate from the original command not found problem. From here, the curl command cheat sheet covers downloads, headers, authentication, and JSON APIs.


Troubleshooting

Symptom Likely cause Fix
bash: curl: command not found on a new VM Package not installed Install curl with the distro table above
sudo dnf -y curl install fails with syntax error Wrong argument order Use sudo dnf install curl
sudo install zypper curl fails install is the wrong subcommand Use sudo zypper install curl
rpm -q curl OK but curl still missing Broken PATH export PATH="$PATH:/usr/bin:/bin" and fix ~/.bashrc
command -v curl empty after install Install failed or /usr/bin is missing from PATH Check ls -l /usr/bin/curl, inspect echo "$PATH", and review the package-install output
Ubuntu suggests Snap only command-not-found default Prefer sudo apt install curl from apt
curl: (6) Could not resolve host DNS or network, not a missing binary Fix resolver or connectivity; curl itself is working
Need libcurl headers for compiling Wrong package scope Install libcurl-devel (RHEL) or libcurl4-openssl-dev (Debian) — separate from the CLI fix

References


Summary

bash: curl: command not found means the shell cannot find the curl executable. Install the curl package with sudo apt install curl, sudo dnf install curl, or the matching command for your distribution, then confirm with curl --version. When the package is already installed, restore PATH so it includes /usr/bin and /bin. After that, use the curl command guide for everyday transfer and API tasks.


Frequently Asked Questions

1. What does bash: curl: command not found mean?

The shell could not find a curl executable in any directory listed in PATH. Either the curl package is not installed, or PATH is missing standard locations such as /usr/bin and /bin even though curl is on disk.

2. How do I install curl on Ubuntu or Debian?

Run sudo apt update && sudo apt install curl. Verify with curl --version and command -v curl (typically /usr/bin/curl). See the install cURL on Ubuntu guide for Snap vs apt and dependency fixes.

3. How do I install curl on RHEL, Rocky Linux, or AlmaLinux?

Run sudo dnf install curl on RHEL 8 and newer. On older releases that still use yum, run sudo yum install curl. Then run curl --version to confirm.

4. Why does curl fail when rpm says curl is installed?

PATH is probably wrong. Run rpm -ql curl to see the binary path (often /usr/bin/curl), then echo $PATH and confirm that directory is listed. Restore PATH with export PATH="$PATH:/usr/bin:/bin" and add the same line to ~/.bashrc if the problem returns every login.

5. Is sudo dnf -y curl install the correct command?

No. The package name comes after install: sudo dnf install curl. The same rule applies to apt—use sudo apt install curl, not sudo apt curl.

6. Should I install curl from Snap on Ubuntu?

Prefer sudo apt install curl. The community Snap is sandboxed and breaks some pipe-to-shell installers. Use apt unless you have a specific reason to use Snap.
Omer Cakmak

Linux Administrator

Highly skilled at managing Debian, Ubuntu, CentOS, Oracle Linux, and Red Hat servers. Proficient in bash scripting, Ansible, and AWX central server management, he handles server operations on OpenStack, KVM, Proxmox, and VMware.

  • Debian
  • Ubuntu
  • Linux
  • Red Hat Enterprise Linux
  • Shell Script
  • System Administration