How to Fix apt-get command not found in Linux
Last Updated :
30 May, 2025
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.
apt-get command not foundHowever, 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 DistributionVerifying 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 InstallationExamining 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 ManagerHow 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.
Similar Reads
How to Fix "pip command not found" in Linux
Python has become an essential tool for developers, data scientists, and system administrators due to its versatility and extensive libraries. The 'pip' tool, which is the standard package manager for Python, plays a crucial role in managing Python packages, libraries, and dependencies. However, enc
9 min read
How to fix Bash: Command Not Found Error in Linux
The "command not found" error is a frequently encountered issue in Linux systems. This error occurs when the system is unable to locate the file specified in the path variable. This error typically occurs when the system cannot locate the command in the directories specified by the path variable.Wha
6 min read
How To Fix "Bash: Docker: Command Not Found" In Linux
Docker has become an essential tool for developers and system administrators to manage and deploy applications efficiently. However, encountering the error message "Bash: Docker: Command Not Found" can be frustrating, especially when you're trying to work with Docker containers. Here, we'll explore
4 min read
How To Fix: Sudo npm: Command not Found on Linux
"npm: Command not Found" is one of the most basic errors we face while getting started with Javascript. We may get this error while installing the node package manager. Node and npm packages are not related to nodejs and therefore not included in the nodejs package. NPM stands for Node Package Manag
2 min read
How to Resolve Python Command Not Found Error in Linux
Getting the "Python command not found" error in Linux usually means Python is missing or not properly set up on your system. This common issue can be caused by missing installations, incorrect PATH settings, or version mismatches. In this guide, youâll learn the exact steps to fix this error, so you
4 min read
apt-get command in Linux with Examples
The command-line tool `apt-get` is the most popular package management tool used in our Debian-based Linux operating system. This article provides an overview of `apt-get` and its basic syntax. It will include the most commonly used commands, their syntax, description, and examples. It also gives an
15+ min read
How to Solve ifconfig Command not Found?
Encountering the "ifconfig command not found" error can be a common issue for users attempting to configure network interfaces on certain operating systems. This error usually indicates that the ifconfig command, which is commonly used to display or configure network interfaces, is either not instal
4 min read
Linux - Installing locate Command to Find Files
In this article, we will see how to install locate command to find files in Linux. locate is a command-line interface tool used for finding files by name in Linux systems. This works more efficiently than other commands. It uses one or more databases by updatedb. To check whether locate utility is a
2 min read
"How to Fix 'jupyter: command not found' Error After Installing with pip "
Encountering the "Jupyter command not found" error after installing Jupyter with pip can be frustrating. This common issue typically arises due to problems with the installation path or virtual environments. In this guide, we'll explore the root causes and provide step-by-step solutions to fix this
4 min read
How to Run a File in Linux
The command line is one of the most powerful tools in Linux. It allows you to execute commands, manage files, and automate tasks all from a single terminal window. One common task you'll often need to do is run a file, whether itâs a script, a compiled program, or even a text file. In this article,
6 min read