apt vs apt-get vs aptitude

If you have copied commands from different Ubuntu tutorials, you have seen all three: some use apt install, others use apt-get install, and occasionally aptitude appears. They all install packages, but they are not interchangeable in every situation. Here is what each one does and when each one belongs.

The short answer

  • Interactive terminal use (daily work): use apt
  • Shell scripts and automation: use apt-get
  • Complex dependency resolution problems: use aptitude

apt-get: the original

apt-get is the original Debian package management command, available since the 1990s. It is stable, scriptable, and its output format is consistent across Ubuntu versions. It is the right choice for scripts because its output is designed to be parsed by machines.

# Install a package
sudo apt-get install nginx

# Update package list
sudo apt-get update

# Upgrade all packages
sudo apt-get upgrade

# Full upgrade (removes packages to resolve conflicts)
sudo apt-get dist-upgrade

# Remove a package
sudo apt-get remove nginx

# Remove and delete config files
sudo apt-get purge nginx

# Remove unused dependencies
sudo apt-get autoremove

# Simulate an operation without applying it
sudo apt-get install --dry-run nginx

apt: the modern frontend

apt was introduced in Ubuntu 14.04 as a higher-level interface over apt-get and apt-cache. It produces more readable output for humans: coloured output, progress bars, and more concise messages. Under the hood, it calls the same library as apt-get.

# apt equivalents to common apt-get commands
sudo apt update              # (same as apt-get update)
sudo apt upgrade             # (same as apt-get upgrade)
sudo apt full-upgrade        # (same as apt-get dist-upgrade)
sudo apt install nginx       # (same as apt-get install)
sudo apt remove nginx        # (same as apt-get remove)
sudo apt purge nginx         # (same as apt-get purge)
sudo apt autoremove          # (same as apt-get autoremove)

# apt adds some commands not in apt-get:
apt list --installed         # List all installed packages
apt list --upgradable        # List packages with updates available
apt search nginx             # Search by name (replaces apt-cache search)
apt show nginx               # Show package details (replaces apt-cache show)

The one difference that matters: apt’s output format is not guaranteed to stay stable across Ubuntu versions. Canonical explicitly warns against using apt in scripts because future releases may change the output format. Use apt-get in scripts.

aptitude: the advanced tool

aptitude is a full-featured package manager that includes both a command-line interface and an interactive text-based UI. Its dependency resolver is more powerful than apt-get’s and can propose multiple solutions when conflicts arise.

# Install aptitude if not present
sudo apt install aptitude

# Use as a command-line tool
sudo aptitude install nginx
sudo aptitude remove nginx
sudo aptitude search nginx
sudo aptitude show nginx

# Launch the interactive text UI
sudo aptitude

# Resolve a broken package situation
# aptitude will offer multiple solutions when apt-get gives up
sudo aptitude install package-with-conflicts

The interactive UI shows installed/available packages categorised by purpose. Navigation uses arrow keys, Enter to expand categories, + to mark for installation, - to mark for removal, and g to apply.

Command comparison table

Taskaptapt-getaptitude
Update package indexapt updateapt-get updateaptitude update
Install a packageapt install pkgapt-get install pkgaptitude install pkg
Remove a packageapt remove pkgapt-get remove pkgaptitude remove pkg
Purge a packageapt purge pkgapt-get purge pkgaptitude purge pkg
Search packagesapt search termapt-cache search termaptitude search term
Show package infoapt show pkgapt-cache show pkgaptitude show pkg
Upgrade allapt upgradeapt-get upgradeaptitude upgrade
Remove unused depsapt autoremoveapt-get autoremoveaptitude (automatic)
List installedapt list --installeddpkg -laptitude search '~i'

When to use each one

SituationUse
Daily interactive terminal workapt — better UX, coloured output
Shell scripts, Ansible playbooks, CI/CDapt-get — stable output format
Broken dependencies that apt-get cannot resolveaptitude — multiple solver strategies
Browsing available packages interactivelyaptitude TUI
Querying the package database (no install/remove)dpkg -l, apt-cache

Conclusion

Use apt for interactive work and apt-get in scripts — this covers 99% of cases. Install aptitude when you encounter a dependency conflict that apt-get cannot resolve; its resolver can find a path through conflicts that apt-get gives up on. All three tools work against the same dpkg database and produce the same end result.

FAQ

Why should administrators understand apt vs apt-get vs aptitude?+

Because this topic affects planning decisions, server lifecycle, compatibility, support expectations, or how you reason about Ubuntu systems before making operational changes.

Do I need a lab for this topic?+

A lab is useful for checking commands and seeing the concept on a real Ubuntu machine, but the main value is understanding the decision, tradeoff, or system behavior clearly.

How should I use this knowledge in production?+

Use it to make better choices, document why those choices were made, and avoid rushed changes that ignore support windows, compatibility, stability, or operational risk.

Need help with Ubuntu administration?

Work directly with Muhammad Irfan Aslam for Ubuntu Server, Linux, cloud, Docker, DevOps, CI/CD, or infrastructure troubleshooting support.

Hire Me for Support