Open In App

How to Fix apt-get command not found in Linux

Last Updated : 30 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Starting from Ubuntu 14.04, a new command called apt was introduced, which didn’t exist in earlier versions. The apt command combines features from several other package management tools like apt-get and apt-cache, offering a simplified interface with additional features such as colorized output and progress bars. Although apt doesn’t support every option that apt-get does, it can often be used as a replacement. Both apt and apt-get are package managers used on Debian-based systems.

apt4
apt-get command not found

However, many users encounter the apt-get: command not found error for different reasons:

  • The /usr/bin/apt-get binary may be missing.
  • The system's PATH variable might be misconfigured, blocking access to necessary directories.
  • The user may be running a non-Debian-based distribution like CentOS or Fedora, where apt-get is not available.
  • Incomplete software installations, power failures, corrupted file systems, or accidental deletion of files can also cause the issue.
  • In severe cases, a full system reinstall may be required.
  • In most cases, the issue can be resolved by manually installing the correct .deb package for apt or fixing the system’s PATH variable.

What is the apt-get Command?

apt-get command is a primary package management utility utilized mostly on Debian family Linux distributions like Ubuntu, Kali Linux, and Debian. It enables users to install, update, configure, and uninstall software packages directly from official repositories. The strength of apt-get is the way it automatically resolves software dependency so that smooth installation and system stability are always assured.

Unlike other package managers present on non-Debian distributions (e.g., yum for RHEL-based or dnf for Fedora), apt-get is particularly optimized for systems that are dependent on .deb package formats. When missing or responding as "command not found", it usually suggests either the lack of the apt package, improper PATH configuration, or the utilization of a non-supported Linux distribution. In spite of such periodic problems, apt-get is still extensively utilized due to its ease, dependability, and effectiveness in software handling on Debian-based systems.

Why Does the "apt-get command not found" Error Occur?

When you encounter the error message "apt-get command not found" in Linux, it means that your system cannot locate the apt-get command. This usually happens because your system doesn’t recognize the apt-get command. Several reasons for this error include:

  • Package Not Installed: The apt-get package may not be installed on your system, particularly on minimal installations or custom setups.
  • Incorrect PATH Variable: Issues with the system’s PATH configuration where the PATH environment variable may not include the directory where apt-get is located. This can result in the "command not found" error.
  • Corrupted Installation:System corruption due to interrupted installs, missing files, or file system modifications, leading to the command's unavailability.
  • Using a non-Debian based distribution that doesn’t support apt-get, such as Fedora, CentOS, Amazon Linux, or Arch Linux.

Linux Distributions that Don't Support apt-get

While apt-get is the default package management tool in Debian-based distributions, not all Linux distributions support it. Some Linux distributions have their package managers. Here are a few examples:

  • Red Hat-based Distributions: CentOS, Fedora, and RHEL (Red Hat Enterprise Linux) use package managers like yum or dnf instead of apt-get.
  • Arch Linux: Arch Linux employs Pacman as its package manager.
  • SUSE Linux: SUSE Linux distributions utilize Zypper as their package manager.

It's essential to be aware of the package manager specific to your Linux distribution to effectively manage software installations and updates.

Below are the steps to fix the apt-get command issue:

Determining Your Linux Distribution

Begin by identifying the Linux distribution you are using, as different distributions employ distinct package management tools. To determine your distribution, execute:

cat /etc/os-release
Determining Your Linux Distribution
Determining Your Linux Distribution

Verifying apt-get Installation

One common cause of the "apt-get command not found" error is the absence of the apt-get package, especially on minimal installations. To ensure apt-get is installed, run:

sudo apt update

If apt-get is missing, you will encounter a "command not found" error. To install it, use:

sudo apt install apt
Verifying apt-get Installation
Verifying apt-get Installation

Examining Environment Variables

Issues with environment variables can cause the "apt-get command not found" error. Ensure that your PATH variable includes the directory where apt-get is located, typically '/usr/bin'. To add '/usr/bin' to your PATH, use the following command:

echo 'export PATH=$PATH:/usr/bin' >> ~/.bashrc

After modifying your PATH, remember to source the updated configuration with:

source ~/.bashrc

Reinstalling the Package Manager

If none of the previous solutions resolve the issue, consider reinstalling the package manager to fix any corrupted or missing package manager files. Run:

sudo apt-get --reinstall install apt
Reinstalling the Package Manager
Reinstalling the Package Manager

How apt-get Works Internally

APT has files specifying repository sources:

  • /etc/apt/sources.list
  • /etc/apt/sources.list.d/

When you run apt-get, it fetches packages from these configured repositories. Each package contains metadata: name, version, description, license, etc. APT grabs the latest version unless specified otherwise. Repository packages are cryptographically signed. The system verifies these signatures to ensure package integrity and authenticity.

Exploring Alternative Package Managers:

If the issue persists, consider alternative package managers like aptitude or apt. These tools are compatible with Debian-based systems and can act as substitutes for apt-get.

To install aptitude, use:

sudo apt install aptitude

To install apt, use:

sudo apt install apt

Conclusion:

Encountering the "apt-get command not found" error in Linux can be frustrating, but with the comprehensive steps provided in this article, you should be well-prepared to address the issue and regain control over your package management tasks. Verify your distribution, confirm apt-get installation, inspect your environment variables, and contemplate alternative package managers if necessary. By following these detailed steps, you'll be fully equipped to resolve package management challenges on your Linux system and continue working effectively.


Next Article

Similar Reads