How to fix apt-get: command not found in Linux

apt, or Advanced Package Tool, is one of the most popular package managers for Linux. It is the program responsible for installing, removing, managing software on Debian and all of the distro based on Debian such as Ubuntu, Linux Mint, Kali and many others.

Most of the time, Linux users interact with two most popular sub-command : apt-get and apt-cache. apt commands usually have to be ran under root privileges or sudo.

This article is going to help you investigate why “apt-get : command not found” error may occurs and a few possible solutions to try once you see the error message.

Basics: apt-get command

apt-get is the main subcommand of apt. Other than apt-get, apt has other subcommands, such as apt-cache and apt-config.

Although you can directly call apt, apt-get is a preferred command that’s recognizable across tutorials on the internet.

apt-get manages packages as well as their dependencies, ensuring the best compatibility for your Linux system.

Below are a few basic apt-get command that we think every Linux user should know:

  • apt-get install <package_name> to install a package from the repositories.
  • apt-get update to update the latest information about packages from the repositories.
  • apt-get upgrade to update all installed packages to their latest versions.
  • apt-get remove <package_name> to remove an installed package. Please note that this command only removes the given package and does not touch its configuration files.
  • apt-get purge <package_name> will completely remove a package along with its configuration files.

Remember to run apt-get commands under root privileges or sudo.

apt-get: command not found error

“apt-get: command not found” simply indicates that the system cannot find apt-get executable in its default location, usually /usr/bin or /usr/local/bin.

This is similar to most of the other “command not found” errors, including “pip: command not found”conda: command not found or “apt-get command not found”.

In order to verify if apt is really missing or not, run the following command:

locate apt-get
Code language: JavaScript (javascript)

Look for /usr/bin/apt-get string in the output. If you don’t see it, then apt-get binary is missing. Below are an example output once you run locate apt-get


Check your Linux distro

One of the most popular reason that you encounter “apt-get: command not found” is using the wrong operating system. apt is the default package manager of Debian and almost all of Debian-based distro like Ubuntu, Linux Mint, Kali Linux. On other Linux distro, apt is simply not included.

For example, RPM-based Linux distributions such as Red Hat, Fedora, CentOS and Amazon Linux uses yum/dnf as their primary package manager.Whereas Arch Linux uses pacman and openSUSE uses zypper.

You can check which Linux distribution you’re using by running the following command :

uname -v #23~20.04.1-Ubuntu SMP Mon Nov 15 14:03:19 UTC 2021
Code language: CSS (css)

Alternatively, running cat /etc/*-release will give you a much more detailed information about the current operating system.


In addition to apt-get, there is a better way to install applications to your Linux machine using AppImage, a new packaging format. AppImage allows applications to run as portable executable files and does not rely on external dependencies.

Reinstall apt-get

You can reinstall APT using its .deb package. This is the fastest way to “reset” APT, which should fix “apt-get: command not found” error.

Follow instructions below to download and install APT:

  • Popular Debian-based distros maintain their own archive mirror, which includes all their DEB packages. For Ubuntu, go to Ubuntu Archive Mirror. Debian users may go to Debian Mirror.
  • If you’re using other Debian-based distro, you may use the DEB package downloaded from Debian Mirror. The same rule applies for Ubuntu users.
  • Browse to /pool/main/a/apt/, you’ll see a bunch of files beginning with apt. Download amd64 file if you’re running Ubuntu 64-bit and i386 file if you’re on the 32-bit version.
  • Once the download progress finishes, you can install APT from the downloaded file by running the dpkg command below.
sudo dpkg -i /path/to/<span style="background-color: inherit; font-family: inherit; font-size: inherit; white-space: pre-wrap; color: inherit;">apt_2.5.4_amd64.deb</span>
Code language: HTML, XML (xml)

Remember to replace the /path/to/apt_2.5.4_amd64.deb with the actual path to the installer in your scenario.

apt-get: command not found in Amazon Linux

apt-get : command not found is a common error message for AWS users who are running Amazon Linux images in their cloud servers.

Amazon Linux is based on CentOS, which in turn based in RHEL. The RHEL family prefer yum over apt as the preferred package manager. So, you would have to use yum to install packages in Amazon Linux.

apt-get: command not found in Google Cloud

Users have reported across online forums that they haven’t been able to use apt properly in Google Cloud Platform virtual machines.

In this case, GCP isn’t the one to blame. If you’ve chosen Ubuntu as the preferred image upon VM creation, you can definitely use apt without any further steps. There are a few possible reasons that can explain this.

  • You could have ticked Containers check-box in Cloud Console while creating the instance. Once the Containers checkbox is activated in instance creation dialog, the boot disk selection will be overridden with Container-Optimized OS, which is a slimmed-down version of Debian/Ubuntu family. apt have been cut out of container-optimized OS to queeze the system for more performance.
  • You’ve selected something else instead of Debian/Ubuntu images, could be CentOS.
  • You’re in some kind of a nested environment inside the OS, which somehow does not have apt preinstalled.

apt-get in macOS

macOS, by default, doesn’t use APT package manager. In fact, the OS doesn’t have a default package manager at all. However, there is a popular apt-get alternative for macOS called Homebrew. We already had a guide covering how you would install Homebrew on macOS, check it out.

On modern macOS versions, you may encounter “The default interactive shell is now zsh” message, we have a guide on how to fix it that you may want to check out.

Sometimes, the Homebrew installer may stuck and left a corrupted installation. In that case, read our guide on possible fixes for “brew: command not found” to find the fix.

Reinstall the OS

In case you’ve tried all the methods above without getting rid of apt-get: command not found, then there may be serious issues with your current setup. We would advise reinstalling the whole operating system.

Remember to backup your data and settings before the reinstall. If you didn’t have a tool of your choice to do that, we recommend rclone, a robust and battle-tested solution preferred by open-source community.

We hope that this tutorial helps you solve the problem effectively and quickly. If you spot any error in the article, or have a suggestion, please let us know via the comment section below.

You might also want to check out our guide on fixing other common apt errors, such as Unable to lock the administration directory (/var/lib/dpkg/), apt-get: Could not resolve or “Depends: package_name but it is not going to be installed” error

Click to rate this post!
[Total: 71 Average: 5]

1 thought on “How to fix apt-get: command not found in Linux”

  1. Thanks a lot. You saved me countless of painful time.


Leave a Comment