VMHeaven

Troubleshooting

curl: command not found — how to fix it on any Linux distribution

Why the shell reports 'curl: command not found' and how to install curl on Debian, Ubuntu, Alpine, Rocky, Alma and inside Docker containers.

Updated 08 Aug 2026~5 min read

You paste a one-line installer, and the shell answers with something like -bash: curl: command not found. Nothing is broken: on a minimal Linux image, curl simply is not installed. Cloud and container images ship as little as possible, and curl is one of the first things left out.

The fix is a single package install. Which command you need depends on the distribution — and if you are inside a container, on whether a package index exists at all.

First: which system are you on?

If you are not sure what you are logged into, ask the system rather than guessing. The package manager is what matters, not the marketing name.

any shell
cat /etc/os-release | head -2

The ID line tells you the family: debian and ubuntu use apt, alpine uses apk, rocky, almalinux, rhel and fedora use dnf.

Installing curl

Debian and Ubuntu

Update the package index first. Without it, apt will often claim the package does not exist, which is the most common follow-up problem on fresh images.

Debian · Ubuntu
sudo apt update
sudo apt install -y curl

Alpine

Alpine is what most slim Docker images are built on. It uses apk, and --no-cache avoids leaving an index behind in the image layer.

Alpine
apk add --no-cache curl

Rocky, AlmaLinux, RHEL and Fedora

Rocky · Alma · RHEL · Fedora
sudo dnf install -y curl

# older releases still using yum
sudo yum install -y curl

Arch and openSUSE

Arch · openSUSE
# Arch
sudo pacman -S --noconfirm curl

# openSUSE
sudo zypper install -y curl

Inside a Docker container

Two things differ in a container: you are usually already root, so sudo does not exist, and the package index is empty because the image was built without it. Both explain why the commands above fail there.

Debian-based image
apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*

Do this in the Dockerfile rather than in a running container — anything you install interactively is gone the moment the container is recreated.

Dockerfile
FROM debian:13-slim
RUN apt-get update \
 && apt-get install -y --no-install-recommends curl ca-certificates \
 && rm -rf /var/lib/apt/lists/*

When curl is installed but still “not found”

Occasionally the package is present and the shell still refuses. There are three realistic causes.

  • The shell cached the lookup. Bash remembers where commands live. After an install, run hash -r to clear that table, or just open a new shell.
  • The binary is not on your PATH. Check with ls -l /usr/bin/curl. If it exists there but the shell disagrees, print echo $PATH and look for a truncated or overwritten value in your .bashrc or .zshrc.
  • You are in a restricted environment. Some managed shells and minimal scratch containers have no package manager at all. There the answer is to rebuild the image with curl baked in.
verify
command -v curl        # prints the full path, or nothing
curl --version         # prints version and supported protocols

If you cannot install anything

On a locked-down box you may not be allowed to add packages. Two substitutes cover most one-off downloads:

without curl
# wget is present on many images that lack curl
wget -qO- https://example.com

# bash can open a TCP socket on its own — no external tool needed
exec 3<>/dev/tcp/example.com/80
printf 'GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n' >&3
cat <&3

A note on fresh servers

If you meet this error on a brand-new VPS, it is worth spending the same five minutes on the rest of the base setup: a non-root user, key-only SSH and automatic security updates. Our images ship with curl present, so the first command you paste just works — see the Standard KVM line if you need a box to try this on.

Frequently asked

Why is curl missing when wget works?

They are separate packages. Minimal images frequently ship wget or neither — installing curl explicitly is normal and safe.

Do I need sudo to install curl?

On a normal user account yes. Inside most Docker containers you are already root, so run the package manager without sudo — the command usually does not exist there.

curl is installed but the shell still says command not found — why?

The binary is not on your PATH, or the shell cached an old lookup. Run 'hash -r', then check 'command -v curl' and inspect $PATH.

More in Troubleshooting

See all