If you are like me, you surely have come across the aptitude and apt command. Not only that, but you should have also seen discussions based on which one is “better”? If you are still wondering, then you have come to the right place as we not only understand both of them but also try to differentiate them in the most unbiased way you can find.
So, what exactly they both do? They both relate to packaging management. Yes, they are popular tools when it comes to handling packages. If you want to handle the different activities such as search, removal, and installation of packages, the tools can come in handy!
However, both of them offer a little different take on package management.
What is APT?
APT stands for Advanced Packaging Tool. It is an open-source tool, which means you can use it without the need to pay anything. APT is designed to handle software installation and removal. APT was part of Debian’s .deb package; however, it was updated to work with the RPM Package Manager.
If you have used APT before, you would have noticed that it is a command-line tool. This means you need to use commands to work with it with no visual reference from a graphical interface(the initial plan was to include a graphical interface, but the idea was later dropped). To use it, you need to provide the package name. The package should have its sources specified in the ‘/etc/apt/sources.list.’ It should also contain all the dependencies list that the package needs to install automatically. If you use the apt command, it will not only download and install the required dependencies for the said package. As a user, you do not have to worry about the package dependencies.
The approach taken by APT is flexible. This means that the user can configure how APT works, including adding new sources, providing up-gradation options, and so on!
With time, APT showed improvements on how it can be handled. Also, Debian developers in full control of how it gets updated.
What is Aptitude?
Aptitude is also an advanced packaging tool. However, it is a front-end tool that gives users access to the user-interface to access functionality. This means that you can use Aptitude to install and remove packages using it. Debian created aptitude. But, with time, they released it for other RPM-based distributions.
If you do not have Aptitude installed, you can install it by using the command below.
sudo apt install aptitude
With Aptitude, you can emulate most of the apt-get’s command line. The user interface also uses the Ncurses library, which is good enough to showcase the installation process.
It is also feature-rich, and you get access to the following features.
- You can flexibly match packages using mutt-like syntax.
- You can preview actions using colors. This means some actions can show in one color while others in a different color.
- You get the option to dselect.
- You can use it to the Debian changelog and also interact with it using the official packages.
- You can automatically mark packages with automatically installed or manually installed. This means that some packages can be uninstalled when they are not needed. This is similar to the package in Apt.
If you want to know more about Aptitude, then I recommend checking Aptitude – Debian Wiki.
Why apt was introduced in the first place?
Before we proceed further, let’s learn more about apt and why it is invented. Debian introduced the Advanced Packaging Tool so that the user can opt to manage their Packaging Tool. However, the command apt is different from the Advanced Packaging Tool(APT).
Some tools can interact with APT and then can be used to manage the packages available in the Debian distributions. One such command is apt-get that you might have used for managing packages. Similarly, the Aptitude tool is also beneficial for package management as it offers command-line and GUI options to the user.
Both Aptitude and apt-get are low-level commands and hence offers tons of functionality to the user. In reality, not all users will use all the available commands. Not only that, the package management commands within the apt-cache and apt-get are scattered and might be too hard for novice users to get a handle of.
That’s why the apt commands are used to solve the problem. It offers a good collection of features from apt-cache and apt-get, mostly used by the user. The user can also use the apt.conf file to manage it.
Difference between APT and Aptitude
Now that we have a good understanding of what APT and Aptitude has to offer, it is now time to learn about their difference. Let’s get started.
The first difference you will notice is that APT is a lower-level package manager, and Aptitude is a high-level package manager. This means that APT can be used in other higher-level package managers.
Another big difference is the functionality offered by both of the tools. Aptitude offers better functionality compared to apt-get. In fact, it contains the functionalities of apt-get, apt-mark, and apt-cache.
For instance, apt-get can be used effectively for package up-gradation, installation, resolving dependencies, system up-gradation, and so on. However, Aptitude offers more features thanks to the inclusion of functionalities of apt-cache and apt-mark. This means Aptitude can be used for more functionality, including package search, setting package installation as automation or manual, and more refined actions on the packages.
If you have been following closely, you by now know that Aptitude comes with an interactive UI in addition to that of the text-only. APT, on the other hand, lacks UI. This is because of the nature of apt-get as it is a low-level package manager and hence restricted to the command-line interface. As Aptitude is a high-level tool, it offers both an interactive interface along with the command-line operation.
In short, Aptitude has more features and hence can be termed as a better package management tool compared to that of apt-get.
Discussing different scenarios
- If you want to remove any installed packages and the unused packages, you need to use Aptitude. In the case of apt-get, you need to mention explicitly that you want to get rid of unused packages by using the option “-auto-remove.”
- In case you want to know more about the behavior of the actions, then Aptitude is your friend as it offers you the why and why-not commands for better access to information. So, if you are confused and want to know if you need a certain package or dependencies, then Aptitude can let you know about it by providing suggestions on packages that need to be installed.
In the above example, we used aptitude to learn about gimp. It showed us recommendations and suggestions. Moreover, it also showed us the depends on some packages. This way, you can completely know what will be installed if you opt to install GIMP. - It is common to have conflicts when you install packages. In the case of apt-get, if a conflict occurs, it won’t fix the issue. It will basically throw out an error and stop working in package removal or conflict of package installation. In comparison, Aptitude offers the ability to work through packages through its powerful search, allowing you to go through the whole repository without limitations.
However, you can use apt-cache to search for a package, but that’s a different variant of apt. - As mentioned above, you can search for packages using apt-cache and aptitude. Let’s see both of them in action here.
As you can see, both methods can let you search for the package if needed. However, the main difference between both of them is. Aptitude shows the package installation status with each package using the p flag, meaning that it is present but not installed. If the package is installed, it will then show the flag i.
Conclusion
What we get at the end? Which one is better, and which one should you use? In simple terms, you can use any of them — considering that your requirement is met. If you find the APT command tool to benefit your work, then, by all means, use it for doing your work. Both are capable of providing the necessary means to do package management. However, if you are looking for a feature-rich approach, you should, by all means, Aptitude.
You surely have read the difference by now; it is your time to share your opinion in the commend section below. Let us know which one you prefer as well!
1 comment
Nice write-up. I’dd add aptitude’s excellent show function, which I now do before any install, as well as a superior simulate function.