Register Login

apt-get command not found in Linux

Updated Feb 01, 2023

The APT (Advanced Package Tools) is a package manager used for managing packages of Debian-based operating systems and its derivatives, such as Ubuntu. APT can be used to install, update the OS and remove applications. While working with APT a common error that is encountered is “apt-get command not found”.

This error occurs when you are trying to install other operating systems that do not support APT. Using the command with the appropriate operating systems will solve the issue.

In this article, we will delve into the details of this error and its solutions.

What is the apt-get command?

The apt-get is a command-line tool used for installing, upgrading, and deleting a Linux package. It fetches information about the packages from authenticated sources to install or remove them, along with their dependencies.

The most common commands under apt-get are as follows:

  • sudo apt-get install (to install a package)
  • sudo apt-get remove (package removal)
  • sudo apt-get update (for updating a package)
  • sudo apt-get upgrade (for upgrading a package)
  • apt-get help (to know more about a command )

Here, sudo is used for providing you with the security privileges of a superuser.

What is the apt-get command not found?

As mentioned earlier, when you try to install or modify a package on Linux with the apt-get command, you might receive this error. It may look something like this:

apt-get install httpd24

Let us see the reasons behind this problem.

Operating System Not Supportive

The apt-get command only works on Debian, Ubuntu, and its derivatives. If you are trying to install rpm-based operating systems such as Fedora, RHEL and CentOS, the command will not work. As a result, you will receive the error.

Distributions that Support apt-get

  • Debian
  • Ubuntu
  • Mint
  • Kali

To find out the Linux distribution name, type in the following command:

cat /etc/*-release

Package Not Available

If you are using an operating system that is compatible with the apt-get command, then check the availability of the APT. Type in the command locate apt-get to check whether it is installed in your system. The command must return the following output –

/usr/bin/apt-get

If no output is returned, it means that the APT package is not installed. You have to manually install it to get things working for you.

How to solve the apt-get command not found an error?

This apt-get command not found error using the following method:

1) Using the Correct Package Manager

The first step to solve the problem is to use the correct Linux distributions with the apt-get command. Avoid trying the download the ones that APT does not support, which are as follows -   

  • CentOS
  • openSUSE
  • RHEL
  • Arch
  • macOS X
  • Fedora

Distributions such as Fedora, CentOS, and RHEL use Yum as their default package manager. Type in the following command to install them using Yum –

$ sudo yum install <packagename>

macOS X uses Homebrew as their default package manager. You can use it by running the command below –

$ brew install tmux

For Arch Linux, you have to use the Pacman package manager like this –

$ packman -S tmux   

2) Downloading the Latest APT Package

Another way to solve this error is to download the latest APT package that is compatible with your system. You have to download the .deb file as per your system architecture, which can be a 32-bit or 64-bit operating system.

Download the .deb file from the “/etc/apt/sources.list” file. Relevant links for installation and upgrades for packages are inside this file. You can check out the downloading source by running the $cat /etc/apt/sources.list command.

Under the downloading source, visit the “/pool/main/a/apt/” directory, locate the .deb file suitable for your architecture and download it. After download, the file, install it using the dpkg command –

$ sudo dpkg -i apt_1.9.3_i386.deb

3) Reinstalling the OS

After installing the APT package, check the /usr/bin/ directory to ensure if it had properly installed. If the file is empty, then run the locate apt-get command again. If no result is shown, there is no alternative but to reinstall the operating system. This might fix the problem.

Make sure all the commands are properly using the sudo access keyword. The apt-get error may arise if the system administrator is not letting you execute the apt-get command on your system.


×