Linux users must learn how to fix the “apt command not found error” on Linux. In this article, you will learn the easiest way to overcome this and access the apt package without any errors.
Apt Command: Intro
Linux provides a tool named APT to install, update, remove, search, and configure packages and repositories from the command line interface. In addition, this CLI has several features and is very user-friendly. Some of the common commands related to APT are:
apt install
: to install packagesapt remove
: to remove packagesapt update
: updating packagesapt upgrade
: to upgrade the packages to the latest versionapt help
: to get help related to the apt command
However, the “apt command not found error” sometimes appears on the Terminal. This is due mainly to two reasons:
- The apt package does not exist in the standard version of Ubuntu.
- The apt package manager runs on an older Linux distribution that does not support the apt command.
Fix the Apt Command Not Found Error
If you wish to fix the apt command not found error, there are several things you need to check. Therefore, follow the instructions to diagnose the reason and fix it. So, let’s get started.
Use the Correct Package Manager
This is the most crucial step—using the correct package manager. If you have any of these OS, then the apt command will not work because these OS support a different package manager. The operating systems are:
- CentOS
- Fedora
- macOS
- openSUSE
- Arch
CentOS, Fedora, and OpenSUSE distributions use the yum package. To handle package management, for instance, installing the new package, the syntax is:
sudo yum install <packagename>
On the other hand, macOS uses homebrew. The syntax is:
brew install tmux
Lastly, Arch OS handles packages using the Pakman package manager, and its syntax looks something like this:
packman -S tmux
Check Operating System Version
First, ensure that you run the right OS for the apt command. The apt command will only work on a few distributions of Linux OS, such as Kali, Mint, Debian, and Ubuntu. On the other hand, any other distribution will not support the apt command.
To check, open the Terminal by pressing “Ctrl + Alt + T” and execute the command given below:
cat /etc/*-release
Hit the “Enter” key, and you should get a similar output as seen below:

If you get any other output, then it means the command is not supported.
Check the APT Command Installation
Alternatively, if you have the appropriate OS, check if the command is installed or not.
For instance, type:
locate apt-get
Press “Enter” key. You should get the output similar to the one below if the command exists on your system:

Update the APT Command Path to Fix the apt command not found Error
Let’s assume in the first step it does not show the command. However, it is already installed. This means the path to the APT is not correct, so you will have to fix it. For this step, run this specific sources.list
file. Specifically, type:
/etc/apt/sources.list
The apt package is located at /usr/bin/apt-get
. If you do not see a similar output, fix the file by running the command given below:
cat /etc/apt/sources.list
Output:

Alternatively, check the environment variable using the .bashrc
file. For instance, type:
~/$[YOURUSER]/.bashrc
Next, update the apt package. For example:
sudo /usr/bin/apt-get update
Lastly, recheck the .bashrc
file to ensure the problem has been resolved.
Install the APT Command to Fix the apt command not found Error
Alternatively, if you do not get the required output in both steps, then the apt command does not exist on your system. Hence, you will install it. There are two approaches to fixing this problem.
Install the APT Package Using the Wget Command
In the Terminal, use the wget
command followed by the URL to the apt
command package. Specifically, type:
sudo wget https://manpages.ubuntu.com/manpages/trusty/man8/apt-get.8.html
Hit the “Enter” key to start the installation of the package. Also, make sure to select the appropriate version for the OS. If your OS has 32-bit architecture, then go for the 32-bit version of the apt command. Otherwise, choose the 64-bit one.
Install the APT Command Using Dpkg
Alternatively, install the apt command using the corresponding .deb package suitable for your OS. in our case, we will use the Ubuntu package. First, head over to the Ubuntu archive URL.
Look for the /pool/main/a/apt/
to locate the apt package. After that, choose the appropriate architecture version. Click on it to download the .deb package. Next, in the Terminal, use the dpkg command to install the downloaded package. For instance, type:
sudo dpkg -i /path/to/apt_deb_file.deb
Remember to replace the sample path with the path in your OS. For example:
sudo dpkg -i /Home/Sidrah/Downloads/apt-get.8.deb
Wait for it to complete and retry Step 1 to ensure the correct installation of the apt command.
Reset the OS
If none of the above steps worked, it is time to reinstall the newer version of the Linux OS. this will install the apt command again and will not cause the apt command not found error. Hopefully, this will fix the problem.
Hopefully, through this guide, you have fixed the apt command and not found an error. Otherwise, the last step will help you have a fresh OS installation. It will quickly fix all the faults. Do not forget to leave a comment below if you have any questions or issues. We will try to include the suggestions in the upcoming articles.
If this guide helped you, please share it.