"command not found" means the shell couldn't locate that program. Either it isn't installed, or it is but isn't on your PATH. Here is how to tell which and fix it.
Quick answer
"command not found" means the shell cannot find that program — either it is not installed or it is not on your PATH. Check with which name; if it is missing, install it with your package manager (apt install or dnf install); if it exists elsewhere, run it with its full path or add its folder to PATH.
Is it installed at all?
Search for the binary. If which finds nothing but the file exists somewhere, it's a PATH problem; if it's nowhere, install it:
which toolname
ls /usr/bin/toolname /usr/local/bin/toolname 2>/dev/nullInstall it
# Debian/Ubuntu
apt install package
# RHEL/Alma/Rocky
dnf install packageInstalled but "not found"? Fix your PATH
If the binary exists but the shell can't see it, its folder isn't on PATH. Add it (and persist it in your shell profile):
export PATH=":/usr/local/bin"
# make it permanent: add that line to ~/.bashrcIf /usr/local/bin/toolname works but toolname alone doesn't, it's definitely PATH — not a missing install.
Not found = not installed, or not on PATH. which/ls to tell which, then install the package or add its folder to PATH.
Cause: wrong package name for your distro
The command and its package aren't always named the same, and package names differ between distro families. If the install command fails with "no package found", search for the actual package name — for example the netstat command comes from the net-tools package on many distros.
Cause: an alias or function only exists in your interactive shell
If a command works in your interactive login shell but not in a script or cron job, it may actually be a shell alias or function defined in your shell profile, which non-interactive shells don't load. Scripts should call the real binary, not rely on aliases.
How to prevent "command not found" issues
- Install tools via your distro's package manager rather than ad-hoc downloads, so PATH is set up automatically.
- Keep a documented list of custom tools and where they live for a new admin joining the server.
- Avoid relying on shell aliases inside scripts or cron jobs.
- Use full paths in automation (cron, systemd units) rather than assuming PATH.
Related errors
If the command exists but you get denied running it, that's permission denied on Linux, a different problem. New to server administration? Start with essential Linux commands or connecting with SSH first.