The “apt” or “apt-get” commands are essential on Linux systems. But what do you do when they’re not available and all you get is a “command not found” error message? Well, I can help.
The “apt-get: command not found” error most likely happens when trying to use the APT package manager on a non Debian-based Linux system. It can be fixed by using the proper command for your specific distribution.
A little lost? Let me explain and give you some tips on how to get around this problem.
“apt-get: command not found” – What does it mean?
APT is the package manager on Debian-based distributions, and the apt-get command is the one used to install new applications. This error most likely means that APT is not installed on the operating system.
What is APT?
On Debian-based distributions, APT is like the App store on your phone. It knows all the applications available, their latest versions, and you can use the “apt” command and its variations to find and install new packages.
So, if it’s not available, it’s pretty annoying. The latest iPhone without the app store is not that useful.
In the next section, I’ll show you how to fix this error, but I just wanted to make sure you understood what it means.
Apt vs apt-get
Also, I have to mention one last point before moving further.
You may find references to “apt” or “apt-get” online. You can use both. “apt” has been added more recently to simplify the command usage, but it does the same thing in the background.
|apt install <package>
|apt-get install <package>
|apt search <name>
|apt-cache search <name>
|apt remove <package>
|apt-get remove <package>
In all my tutorials on this website, I now mention “apt” instead of “apt-get”, “apt-cache”, etc. But if you are familiar with the old way, it’s not a problem.
The main problem we need to fix now is how to get rid of this “command not found” error, whether you use one or the other!
If you’re new to the Linux command line, this article will give you the most important Linux commands to know, plus a free downloadable cheat sheet to keep handy.
Fixing the “apt-get: command not found” error
If you’re sure it’s not just a typo and you haven’t typed “atp-get install” or something similar, here are a few things you can try.
Make sure you’re using a Debian-based distribution
As mentioned in the introduction, the main reason why we get the error “apt-get: command not found” is that the system we are connected to is not based on Debian.
So before trying anything else, just make sure to check what system you’re using.
The “apt” and “apt-get” commands are only available by default on Debian-based distributions, which include: Debian, Ubuntu (and all its variations), Kali Linux, Linux Mint, Raspberry Pi OS (formerly Raspbian), MX Linux, Zorin, etc.
If you use other popular Linux distributions, like Fedora, Arch / Manjaro, SUSE / openSUSE, Gentoo or Alpine, you’re trying to use the wrong tool. These distributions have a different package manager, and a different command (as we’ll see next).
How to know which distribution you use?
- In most cases, you’ll have a logo or name mentioning it in the boot process, login screen or wallpaper.
- If you have access to the command line, you can try this command:
lsb_release -aIt will give the Linux distribution name and version, something like:
- If a GUI is installed, you can also visit the “About” section in the system settings.
Here is an example on Ubuntu:
Using other package managers
On a non-Debian-based system, an alternative to APT is available to install and manage applications on your system. For example, Red Hat base distributions use DNF instead of APT.
Here is a list of the package managers available for the most popular systems and distributions:
|Ubuntu, Kali, Linux Mint
|Fedora, CentOS, Rocky Linux
|DNF (or YUM)
Check the documentation from your system to know how to use these package managers. They are often very similar to APT, but you may need a bit of practice to get used to them.
I have several tutorials on the website that you can check for examples:
- How to Install Gentoo Linux on Raspberry Pi? (Quick Method)
- How To Install And Use Fedora On Your Raspberry Pi?
- How to Install Manjaro on Raspberry Pi?
They are all for Raspberry Pi, but you can skip the installation part (as you already have it), and just check the section where I introduce the package manager usage.
Now, if you are sure that you are on a Debian-based distribution, but for some reason, the “apt” command is not installed, then you can try to install it manually.
On Debian-based systems, we can use “dpkg” to install manually a “.deb” file to add a new application to the system.
While APT is used on top of this in most cases, if “apt” is missing, here’s what you can try:
- Go to the official website and find the package pages.
In general, you’ll have a search engine, where you can find and download most packages for your system.
- Do a quick search for “apt” and see if you can find the package for your system version.
For Debian it might be this page, and for Ubuntu this one.
These links are for specific versions, so take them as examples, but pick the right version for you.
- Download the .deb package for your system architecture.
For Debian and Ubuntu, there is a table at the bottom of the page with the architecture list.
You then need to pick a mirror server to download the package.
- Once the package is downloaded, install it manually:
sudo dpkg -i <package_name.deb>
If dependencies are missing, repeat the same process to install them, one by one, with their .deb file (or from the sources in some cases). That’s the part where we’re glad APT exists. Most of the time, we no longer worry about dependencies once the system is properly installed :-).
You may find APT available for other systems, but it’s generally a bad idea. It’s not built for it, and will most likely break your system (I tried to install YUM on Ubuntu one day if you want to see the results).
If you’re not using a distribution based on Debian, it’s not the end of the world. Just take the time to learn how their package manager works. After a few installations, you’ll be up to speed. Most of the other commands are the same anyway.
If you are looking for exclusive tutorials, I post a new course each month, available for premium members only. Join the community to get access to all of them right now!
Overwhelmed with Linux commands?
My e-book, “Master Linux Commands”, is your essential guide to mastering the terminal. Get practical tips, real-world examples, and a bonus cheat sheet to keep by your side.
Grab your copy now.
If you just want to hang out with me and other Linux fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.
Need help building something with Python?
Python is a great language to get started with programming on any Linux computer.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now.