What is APT and Aptitude? and What’s real Difference Between Them?

Aptitude and apt-get are two of the popular tools which handle package management. Both are capable of handling all kinds of activities on packages including installation, removal, search etc. But still there are differences between both the tools which make users prefer one over the other. What are those differences that make these two tools to be considered separately is the scope of this article.

Difference Between APT and Aptitude
Difference Between APT and Aptitude

What is Apt

Apt or Advanced Packaging Tool is a free and open source software which gracefully handles software installation and removal. Initially it was designed for Debian’s .deb packages but it has been made compatible with RPM Package Manager.

Apt is whole command line with no GUI. Whenever invoked from command line along with specifying the name of package to be installed, it finds that package in configured list of sources specified in ‘/etc/apt/sources.list’ along with the list of dependencies for that package and sorts them and automatically installs them along with the current package thus letting user not to worry of installing dependencies.

It is highly flexible allowing User to control various configurations easily, like: adding any new source to search for packages, apt-pinning i.e. marking any package unavailable during system up-gradation thus making its current version be its final version installed, “smart” upgrade i.e. upgrading most important packages and leaving the least important ones.

What is Aptitude?

Aptitude is front-end to advanced packaging tool which adds a user interface to the functionality, thus allowing a user to interactively search for a package and install or remove it. Initially created for Debain, Aptitude extends its functionality to RPM based distributions as well.

Its user interface is based on ncurses library which adds various elements to it commonly seen in GUI’s. One of its highlight is that it can emulate most of apt-get’s command line arguments.

In all, Aptitude is a higher-level package managers that abstracts low level details, and can operate in both text-based interactive UI mode and even in command line non-interactive mode.

If you want know the usage of APT and Aptitude with real world examples, you should head over to the following articles.

  1. Learn 25 Useful Examples on APT-GET and APT-CACHE
  2. Learn Linux Package Management with Aptitude and Dpkg

What’s Differences Between APT and Aptitude?

Apart from main difference being that Aptitude is a high-level package manager while APT is lower-level package manager which can be used by other higher-level package managers, other main highlights that separate these two package managers are:

  1. Aptitude is vaster in functionality than apt-get and integrates functionalities of apt-get and its other variants including apt-mark and apt-cache.

While apt-get handles all the package installation, up-gradation, system-upgradation, purging package, resolving dependencies etc., Aptitude handles lot more stuff than apt, including functionalities of apt-mark and apt-cache i.e. searching for a package in list of installed packages, marking a package to be automatically or manually installed, holding a package making it unavailable for up-gradation and so on.

  1. While apt-get lacks UI, Aptitude has a text-only and interactive UI

Apt-get being a lower level package manager is restricted only to command line, while Aptitude being a higher-level tool has a default text-only interactive interface along with option of command-line operation by entering required commands.

  1. Aptitude has a better package management than apt-get

In many situations involving installation, removal and conflict resolution for packages, Aptitude proves its worth rather than apt-get. Some of the situations include:

1. While removing any installed package, Aptitude will automatically remove unused packages, while apt-get would need user to explicitly specify this by either adding additional option of ‘—auto-remove’ or specifying ‘apt-get autoremove’.4

2. To investigate further as to why certain action is getting blocked or why or why-not a certain action should be taken, Aptitude offers 'why' and ‘why-not’ commands.

Like: Aptitude can find you the reason to install a certain package by looking in the list of installed packages and checking if any of their suggested packages has a dependencies or any of their dependencies suggests that package or so on.

$ aptitude why yaws-wiki
i   doc-base  Suggests   dhelp | dwww | doc-central | yelp | khelpcenter4
p   dwww      Depends    apache2 | httpd-cgi
p   yaws      Provides   httpd-cgi
p   yaws      Suggests   yaws-wiki

Like here it searched for the reason to install a package named 'yaws-wiki' to be that it is suggested by a dependency (yaws) which provides a virtual package (httpd-cgi) on which package (dwww) has dependency and package (dwww) is suggested by one of the installed packages named 'doc-base'.

This feature is missing in apt-get.

3. While apt-get would probably die-out in case of conflicting action regarding installation or removal of package with a message, Aptitude can suggest possible measures to remove that conflict.

Aptitude provides a powerful search which can be used to search almost any package not only on the system but also on the entire repository.

Whereas apt-get needs another apt’s variant i.e. apt-cache to search for a package, Aptitude provides much easier and efficient way to search for a package which is either installed or present in repository but yet to be installed.

Searching a package using apt-cache vs Aptitude

$ apt-cache search 'python' | head -n4
kate - powerful text editor
kcachegrind-converters - format converters for KCachegrind profiler visualisation tool
kig - interactive geometry tool for KDE
python-kde4 - Python bindings for the KDE Development Platform

$ aptitude search 'python' | head -n4
i   bpython                         - fancy interface to the Python interpreter 
p   bpython-gtk                     - fancy interface to the Python interpreter 
p   bpython-urwid                   - fancy interface to the Python interpreter 
p   bpython3                        - fancy interface to the Python3 interpreter

Here, by default both apt-cache and aptitude search for a package on whole list of packages in repository, but output of aptitude shows whether the package is installed on the system or not by giving a per-package flag which here is 'p' indicating that package is present but not installed and 'i' which indicates that the package is installed, whereas apt-cache just lists the package and its one-line detail without telling if package is installed or not.

Some other examples of advanced package search with Aptitude

1. Searching for a package in repository with 'python2.7' in the name of package and '2.7' in its description.

$ aptitude search '~npython2.7 ~d2.7'
p   idle-python2.7                   - IDE for Python (v2.7) using Tkinter       
i   libpython2.7                     - Shared Python runtime library (version 2.7
p   libpython2.7:i386                - Shared Python runtime library (version 2.7
p   libpython2.7-dbg                 - Debug Build of the Python Interpreter (ver
p   libpython2.7-dbg:i386            - Debug Build of the Python Interpreter (ver
i A libpython2.7-dev                 - Header files and a static library for Pyth
p   libpython2.7-dev:i386            - Header files and a static library for Pyth
i   libpython2.7-minimal             - Minimal subset of the Python language (ver
p   libpython2.7-minimal:i386        - Minimal subset of the Python language (ver
i   libpython2.7-stdlib              - Interactive high-level object-oriented lan
p   libpython2.7-stdlib:i386         - Interactive high-level object-oriented lan
p   libpython2.7-testsuite           - Testsuite for the Python standard library 
i   python2.7                        - Interactive high-level object-oriented lan
p   python2.7:i386                   - Interactive high-level object-oriented lan
p   python2.7-dbg                    - Debug Build of the Python Interpreter (ver
p   python2.7-dbg:i386               - Debug Build of the Python Interpreter (ver
i A python2.7-dev                    - Header files and a static library for Pyth
p   python2.7-dev:i386               - Header files and a static library for Pyth
p   python2.7-doc                    - Documentation for the high-level object-or
p   python2.7-examples               - Examples for the Python language (v2.7)   
i   python2.7-minimal                - Minimal subset of the Python language (ver
p   python2.7-minimal:i386           - Minimal subset of the Python language (ver

Here '~n' indicates name and '~d' indicates description. Other form of same command is:

$ aptitude search '?name(python2.7) ?description(2.7)'
Some other flags include:
  1. ~i or ?installed(): Searching for a package in the list of installed packages only.
  2. ~U or ~Upgradable: Lists all the packages which are upgradable with their latest available versions.
  3. ~E or ?Essential(): Those packages either installed or available, which are essential.
$ aptitude versions '?Upgradable' | head -n 12
Package apache2:
ph  2.4.7-1ubuntu4                                trusty                    500 
ph  2.4.7-1ubuntu4.5                              trusty-security           500 
ih  2.4.7-1ubuntu4.8                                                        100 
ph  2.4.7-1ubuntu4.9                              trusty-updates            500 

Package apache2-bin:
p A 2.4.7-1ubuntu4                                trusty                    500 
p A 2.4.7-1ubuntu4.5                              trusty-security           500 
i A 2.4.7-1ubuntu4.8                                                        100 
p A 2.4.7-1ubuntu4.9                              trusty-updates            500 

Like a short list shown here of 3 packages with installed version (indicated with 'i') and their upgradable version present (indicated with 'p').

2. Finding all packages that provide a particular service

To find all packages those provide smtp service:

$ aptitude search '?provides(smtp)'
p   libghc-smtpclient-dev            - Simple Haskell SMTP client library        
p   libghc-smtpclient-dev:i386       - Simple Haskell SMTP client library        
p   libghc-smtpclient-prof           - Simple Haskell SMTP client library; profil
p   libghc-smtpclient-prof:i386      - Simple Haskell SMTP client library; profil
p   syslog-ng-mod-smtp               - Enhanced system logging daemon (SMTP plugi
p   syslog-ng-mod-smtp:i386          - Enhanced system logging daemon (SMTP plugi

3. Finding all packages that suggest a certain package

Like here, we list all packages that suggest ‘gcc’ package.

$ aptitude search '~DSuggests:gcc' | head -n10
p   bochs                           - IA-32 PC emulator                         
p   bochs:i386                      - IA-32 PC emulator                         
p   cpp-4.4                         - GNU C preprocessor                        
p   cpp-4.4:i386                    - GNU C preprocessor                        
p   cpp-4.6                         - GNU C preprocessor                        
p   cpp-4.6:i386                    - GNU C preprocessor                        
p   cpp-4.7                         - GNU C preprocessor                        
p   cpp-4.7:i386                    - GNU C preprocessor                        
p   cpp-4.7-arm-linux-gnueabi       - GNU C preprocessor                        
p   cpp-4.7-arm-linux-gnueabi:i386  - GNU C preprocessor 

Conclusion

So, for most of the cases, syntax of Aptitude is kept almost same as that of apt-get, to make users of apt-get have less pain in migrating to Aptitude, but in addition to this, many powerful features are integrated in Aptitude that make it the one to be chosen. Apart from these differences that we highlighted, if you find any other interesting differences between these two package managers, do mention them in your comments.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Gunjit Khera
Currently a Computer Science student and a geek when it comes to Operating System and its concepts. Have 1+ years of experience in Linux and currently doing a research on its internals along with developing applications for Linux on python and C.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

7 Comments

Leave a Reply
  1. I use apt for command line, but find Synaptic the best front end GUI for searching for packages. Synaptic is indispensable in my opinion with all the package management functions it preforms.

    Reply
  2. “vaster in functionality” or “master in functionality”. Which one is true? (Aptitude is vaster in functionality than apt-get and integrates functionalities of apt-get and its other variants including apt-mark and apt-cache.)

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.