| 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.
curl --versionOn RHEL 10.2 without the package, or in a minimal Ubuntu 26.04 container before install:
bash: curl: command not foundDesktop 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:
sudo apt updateThen install:
sudo apt install curlOn RHEL-family systems, dnf pulls curl from the base repository:
sudo dnf install curlI 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:
rpm -q curlSample output:
curl-8.12.1-4.el10.x86_64List the binary path the package owns:
rpm -ql curl | grep '/curl$'Sample output:
/usr/bin/curlOn 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:
command -v curlWhen 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:
echo $PATHA 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:
PATH=/usr/games:/usr/local/games curl --versionSample output:
bash: curl: command not foundAdd the missing standard directories for the current shell:
export PATH="$PATH:/usr/bin:/bin"Run curl again:
curl --versionSample 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-13To 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:
command -v curlSample output:
/usr/bin/curlCheck the installed version string:
curl --versionSample 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-13A quick HTTPS HEAD request proves networking works end to end:
curl -sI https://www.golinuxcloud.com/ | head -3If 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
- curl manual —
man curlon any system with thecurlpackage installed - curl project documentation — https://curl.se/docs/
- Debian
curlpackage — https://packages.debian.org/search?keywords=curl - RHEL
curlpackage — https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/
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.

