Methods of payment Abuse

What does apt-get command not found error mean?

16.03.2024, 02:13

apt-get is a command-line utility for package management on Debian-based operating systems such as Ubuntu. It is used to install, uninstall, update, and manage software packages on the system.

Considering that this package manager is one of the almost most basic packages of the system, it is logical that the program should be present in every distribution. Still, it is not uncommon for users to encounter the error apt get command not found. In this article we will look at why such an error occurs, how it can be and how to fix apt get command not found.

Basic apt-get commands

Let's take a look at the basic commands:

apt-get update

Updates the list of available packages from the repositories.

apt-get upgrade

Updates all installed packages to their latest versions.

apt-get install <package>

Installs the specified package.

apt-get autoremove

Removes unnecessary dependencies that are no longer used by other packages.

apt-get dist-upgrade

Updates the system to a new version, if one is available.

Overall, the utility is a powerful tool for managing packages on Debian-based systems and can be used for system upgrades, installing new software, and many other tasks.

What does apt get command not found mean?

The error message means that the command you are trying to execute is not found on the system. It is either not installed or has been uninstalled. But all this sounds very strange in relation to the package manager.

The main reasons why the error occurs:

  1. One of the most obvious reasons, of getting the"apt get not found" error is that you don't have Ubuntu. This package manager is only used in Debian-based Linux distributions. Red Hat, CentOS, Fedora, OpenSUSE, CoreOS, Cloud Linux, ArchLlinux and other systems are not. They have their own package manager, each has its own and that is what you should use to install packages, not look for apt. If you are using the apt command and not apt-get, you may have an older distribution that doesn't support that syntax, use apt-get.
  2. You have accidentally or intentionally removed the Apt package. It is no longer on the system, which is why the system cannot find it.
  3. Unable to locate the program. The apt utility is on the system and working fine, but you have corrupted the PATH environment variable and now the system is not looking for executables in the folder where apt is located.

Now let's see how to fix the problem. It's very simple.

How to fix apt get command not found?

First make sure that the cause is not the second item. Usually apt executables are located in the /usr/bin directory. Let's first see if there is such a file in that folder:

$ ls -l /usr/bin/apt-get

Pay attention to the permissions. For user, group, and others, the"x" flag should be set to execute. If it is not, apt will have to be reinstalled.

If the permissions are different from the above, namely"-rwxr-xr-x", then you will need to fix them too by adding an executable flag for all categories:

$ chmod +x /usr/bin/apt-get

If the previous options didn't work check the contents of the PATH environment variable:

$ echo $PATH

You should see a reference to /usr/bin in it. If there is no such line, then the problem was here, and the line should be added to the end:

$ export PATH=current_content:/usr/bin

For example:

$ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

If you made changes to the /etc/profile file, and the PATH variable broke because of that, then you need to make corrections to that file as well.

What to do if nothing has worked?

We recommend that you simply reinstall the utility. Download it from the official website and install it on the system. Only you need to choose the version for your OS. You can download the package using a browser or commands like these:

For Ubuntu Xenial:

$ wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.2.15ubuntu0.2_i386.deb

For Ubuntu Yakkety:

$ wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.3.3_i386.deb

Now the only thing left to do is to install the downloaded package:

$ sudo dpkg -i apt*

Done, after that the error apt get command not found should disappear and you should be able to work normally with your packages.