How to Fix curl Command Not Found in Linux

The curl command-line utility is an indispensable tool in Linux environments for transferring data using network protocols such as HTTP, HTTPS, FTP, and SCP. It is routinely used to download configuration scripts, test REST APIs, verify SSL certificates, and fetch software repositories. However, minimal Linux installations, container base images (such as Ubuntu, Debian, or Alpine Docker images), and hardened server environments often exclude curl by default, resulting in the error: bash: curl: command not found.

Why Is curl Missing from Linux Systems?

The error indicates that the current terminal shell cannot locate an executable binary named curl in any directory specified by your user’s $PATH environment variable. Typical reasons include:

  • Minimal OS Installations: Standard cloud images and container images strip out non-essential utilities to reduce attack surface and disk footprint.
  • Corrupted or Missing Binary Symlinks: In rare cases, curl is installed under /usr/local/bin or /opt, but the active shell cannot locate the binary path.
  • Incomplete Package Manager Initialisation: Package repositories have not yet been indexed on newly provisioned servers, blocking command execution.

Method 1: Install curl on Ubuntu and Debian Distributions

On Debian-derived distributions, including Ubuntu, Linux Mint, and Kali Linux, use the apt package manager to update repository indexes and install the utility.

  1. Open your terminal or connect via SSH.
  2. Synchronise the local package index with upstream repositories:
    sudo apt update
  3. Install the curl package:
    sudo apt install curl -y
  4. Verify successful installation by checking the installed version and supported protocols:
    curl --version

Method 2: Install curl on RHEL, CentOS, AlmaLinux, and Rocky Linux

Enterprise Linux operating systems utilize either dnf or legacy yum package managers.

  1. On modern distributions (RHEL 8/9, AlmaLinux, Rocky Linux, Fedora), run:
    sudo dnf install curl -y
  2. On legacy CentOS 7 servers, run:
    sudo yum install curl -y
  3. Confirm that the binary is available in standard system paths:
    which curl

Method 3: Install curl on Alpine Linux and Arch Linux

Lightweight containers and rolling distributions use distinct package managers.

  1. On Alpine Linux (frequently encountered in Docker containers), execute:
    apk add --no-cache curl
  2. On Arch Linux and Manjaro systems, execute:
    sudo pacman -S curl --noconfirm
  3. Test connectivity by fetching standard HTTP headers from a public domain:
    curl -I https://www.google.com

Method 4: Fix PATH Variable Issues

If you have already installed curl from source or custom packages but the shell still reports the command missing, verify your search path.

  1. Check the contents of your current PATH variable:
    echo $PATH
  2. Search the filesystem to locate where the curl binary is stored:
    find / -name "curl" 2>/dev/null
  3. If curl resides in /usr/local/bin but that directory is missing from your path, export it in your profile:
    export PATH=$PATH:/usr/local/bin
  4. Add this export line to the bottom of your ~/.bashrc or ~/.zshrc file to ensure persistence across future terminal sessions.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.