" "
spot_img
HomeSTORAGESteps to Fix "apt-get: command not found" error in...

Steps to Fix “apt-get: command not found” error in Linux

APT, or Advanced Package Tool, is a package management system that manages, installs, and removes software packages on Debian-based Linux distributions like Ubuntu. APT is not a single command, but it’s a set of tools delivered as packages, including apt, apt-cache, and apt-get. Though it makes software management easier what if it does not work and you receive the “Apt Get-Command Not Found” error message? Let us see how to fix and access the apt command without error.
Apt-get Command
Apt-get is a command-line tool for handling packages on Linux distributions. It allows users to easily install, update, and uninstall software packages. Apt-get simplifies package management by resolving dependencies and keeping your software up to date.
The “apt-get Command Not Found” Error
If you receive the “apt-get command not found” error message on Linux, it indicates that the apt-get command cannot be found on your system. The reasons for the error are the Packages not installed properly, Incorrect PATH variables, and Corrupted Installation.
Distribution that does not support “apt”
The “apt” command works on Debian, Ubuntu, Linux Mint, Kali Linux, and Parrot OS. Not all Linux distributions support it, and some have their package managers.
A few examples:

Red Hat-based Distributions: CentOS, Fedora, and RHEL use yum or dnf as their package managers.
Arch Linux: Pacman as their package manager.
SUSE Linux: Zypper as their package manager.

Note: To manage software installations and updates, you must be familiar with your Linux distribution’s package manager.
Check Linux Distribution
First, make sure that you are running the correct OS for the apt command. Apt-get, or apt command, is the default package manager on Debian-based distributions and the apt command will only work on a selected Linux distribution, like Kali, Mint, Debian, and Ubuntu. However, the apt command will not support any other distribution.
To find your Linux distribution, execute the following command:
cat /etc/os-release
Install apt package
To fix this error, you must verify whether your system has the “apt-get” package already installed. Run the following command:
which apt-get
If it does not return anything, then install ‘apt’ as follows.
You can install the “apt” package using the “apt-get” command, which is available on your Debian system by default. Check the installation with the following command:
sudo apt update
You will receive a “command not found” error if apt-get is not installed. To install apt-get use the below command:
sudo apt-get install apt
This will update and install the “apt” package. After the installation, you will be able to run the “apt” command without any error.
Verify the Environment Variables
Sometimes an error in environment variables will lead to an “apt-get command not found” error. So, fix the correct APT command path and make sure that the PATH variables contain the directory where apt-get is located. Use the following command to add ‘/usr/bin’ to your PATH:
echo ‘export PATH=$PATH:/usr/bin’ >> ~/.bashrc
After the PATH modification, update the configuration with:
source ~/.bashrc
Finally, check the .bashrc file to make sure the error has been fixed.
Reinstalling OS
If the previous steps did not resolve the error, then try reinstalling the package manager to fix corrupted or missing packages by following the command:
sudo apt-get –reinstall install apt
Hopefully, it will resolve the error by reinstalling the apt command without causing the error “apt command not found”.
Alternative Package Managers
If the error continues, then use an alternative package manager like apt or aptitude. These tools are Debian-compatible and can be used instead of apt-get.
To install aptitude:
sudo apt install aptitude
To install apt:
sudo apt install apt
The common reason for this error message is the wrong use of a package manager not compatible with the installed Linux distribution. However, the above troubleshooting methods will help you to resolve the issue and regain control of your package management. Check the distribution, verify apt-get installation, examine your environment variables, and consider using different package managers if necessary.
Hope this has helped you to fix the apt-get command not found, if you need any assistance feel free to Get assistance.
To get more updates you can follow us on Facebook, Twitter, LinkedIn
Subscribe to get free blog content to your Inbox

- Advertisement -

- Advertisement -