The error “sudo: apt-get: command not found” means your Linux distribution does not use the APT package manager, so the apt-get command is not installed. The fix is to use your distribution’s native package manager, such as dnf, yum, pacman, or zypper, or to install apt if you are on a Debian-based system but the command is missing.
Why does “sudo apt-get: command not found” happen?
APT (Advanced Package Tool) is the package manager for Debian and its derivatives like Ubuntu, Linux Mint, and Pop!_OS. If you run apt-get on a distribution that isn’t Debian-based, the shell cannot find the executable because it simply isn’t present. The most common causes are:
- You are using a Red Hat–based distribution (Fedora, CentOS, RHEL) that uses
dnforyum. - You are using Arch Linux or Manjaro, which use
pacman. - You are using openSUSE, which uses
zypper. - You are on a minimal Debian/Ubuntu installation where the
aptpackage is not installed (rare, but possible). - Your PATH environment variable does not include
/usr/binor/bin, so the shell can’t find the command even though it exists.
Check your distribution with cat /etc/os-release to see exactly what you are running. That file contains the distro name and version, which tells you which package manager you should use.
How to fix it on Red Hat–based systems (Fedora, CentOS, RHEL)
On Fedora, CentOS, RHEL, and other Red Hat–derived distributions, the default package manager is dnf (on newer versions) or yum (on older ones). Use these commands instead of apt-get:
- Update the package list:
sudo dnf update(orsudo yum update). - Install a package:
sudo dnf install package-name. - Remove a package:
sudo dnf remove package-name. - Search for a package:
dnf search keyword.
If dnf is not available, try yum. On very old CentOS 6 or 7, yum is the only option. On modern Fedora, yum is a symlink to dnf, so either works.
How to fix it on Arch Linux and Manjaro
Arch Linux and its derivatives like Manjaro use pacman. The syntax is slightly different but straightforward:
- Update the package database and upgrade all packages:
sudo pacman -Syu. - Install a package:
sudo pacman -S package-name. - Remove a package:
sudo pacman -R package-name. - Search for a package:
pacman -Ss keyword.
Manjaro also includes pamac, a friendly front-end that can install packages from the official repos and the AUR. For example, pamac install package-name.
How to fix it on openSUSE
openSUSE uses zypper. Common commands include:
- Refresh the repository list:
sudo zypper refresh. - Install a package:
sudo zypper install package-name. - Remove a package:
sudo zypper remove package-name. - Search:
zypper search keyword.
If you are on a SUSE Enterprise system, the same commands apply.
What if you are on Debian/Ubuntu but apt-get is missing?
On a standard Debian or Ubuntu installation, apt-get is always present. If it isn’t, you likely have a minimal container or a stripped-down system where the apt package was removed. To reinstall it without apt-get, you need to download the .deb package manually and install it with dpkg. However, this is rare and usually happens only in Docker images or custom minimal builds. A simpler approach is to use apt (the newer front-end) if it exists: sudo apt update. If neither apt nor apt-get is available, you can use dpkg to install a downloaded .deb file, but you’ll need to fetch the dependencies manually. In practice, if you are on Debian/Ubuntu and see this error, double-check that you are actually in the correct container or chroot—it’s easy to be in a different environment than you think.
Using the correct package manager is safer and more reliable
Attempting to install apt-get on a non-Debian system is not recommended. Mixing package managers can break your system because each manager tracks its own database of installed files. If you force-install an APT package on Fedora, it will place files in the filesystem without registering them with dnf, leading to conflicts and missing dependencies. Always use the native package manager for your distribution. If you need a package that isn’t in the official repos, look for a distribution-specific package (like an .rpm for Red Hat systems) or use the distribution’s community repositories (e.g., EPEL for CentOS/RHEL, AUR for Arch, Packman for openSUSE).
Common related errors and misconceptions
One common misconception is that apt-get is the only way to install software on Linux. In reality, every distribution has its own tool. Another frequent error is sudo: apt-get: command not found when you’re actually in a Windows Subsystem for Linux (WSL) environment that uses a non-Debian distro. For example, if you installed WSL with Fedora or openSUSE, you’ll get this error. The fix is the same: use the appropriate command for that distro. Also, note that on some systems the command is simply apt instead of apt-get. apt is a newer, more user-friendly front-end that is available on Debian 8+ and Ubuntu 16.04+. It works exactly like apt-get for most tasks, so if apt-get is missing but apt exists, use sudo apt update and sudo apt install package-name.
Frequently Asked Questions
Is apt-get the same as apt?
No, they are related but not identical. apt-get is the older, lower-level tool that has been around since the early days of Debian. apt is a newer front-end that combines the most common commands of apt-get and apt-cache into a single, more user-friendly interface. For everyday tasks like installing, updating, and removing packages, they behave the same. However, apt-get is more script-friendly because its output is stable, while apt may show progress bars and colors that are not ideal for automation.
Can I install apt-get on Fedora or Arch?
Technically you can, but you shouldn’t. The apt package exists in the Fedora repos and in the AUR, but it is meant for developers who need to test Debian packages, not for regular system management. Using it to install software will likely break your system because it doesn’t integrate with your native package manager. Always use dnf on Fedora and pacman on Arch.
What does “command not found” actually mean?
It means the shell (usually Bash) searched every directory in your PATH environment variable and did not find an executable file named apt-get. It does not mean the command is broken; it means it isn’t installed. The error is the same whether you type a typo like aptget or a real command that isn’t on your system.
How do I know which package manager my Linux uses?
Run cat /etc/os-release and look for the “ID” line. If it says ID=ubuntu or ID=debian, use apt. If it says ID=fedora or ID=centos, use dnf/yum. If it says ID=arch, use pacman. If it says ID=opensuse, use zypper. This file is present on virtually all modern distributions.
Why did my Docker container give this error?
Docker containers are often based on minimal images like Alpine Linux, which uses apk instead of apt-get. If you run a command like apt-get update inside an Alpine container, you’ll get “command not found.” Check the base image in your Dockerfile; if it’s alpine, use apk add. If it’s ubuntu or debian, apt-get should work.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Compressed Zipped Folder Access Denied? Fix It
- IPTV TV Boxes: How to Choose the Right Streaming Device
- Custom Races in Assetto Corsa: Server Setup Guide
- Dueling Grounds Events Schedule: Full Guide
- Evaluating Co-Packaged Optics Switches for AI Data Centers
- RTX 5080 Best Settings for 1440p & 4K Gaming