apt vs apt-get: The Difference and When to Use Each

By 

•

Updated on

•

8 min read

apt vs apt-get comparison

Both apt and apt-get manage packages on Debian-based systems. They talk to the same package database, resolve the same dependencies, and pull from the same repositories. Yet they exist as separate tools, and choosing the wrong one in the wrong context can cause minor headaches. The short answer: apt is for people at a terminal, apt-get is for scripts.

This guide explains how apt and apt-get differ, when to use each one, and how their commands map to each other.

Why Two Tools Exist

apt-get has been the standard Debian package manager since 1998. It is reliable and well-documented, but its interface was designed for an era when terminal usability was an afterthought. Related tasks like searching and showing package details live in a separate tool called apt-cache, so users constantly switch between the two.

The apt command was introduced in Debian 8 and Ubuntu 14.04 (APT version 1.0, released in 2014) as a user-friendly front end. It combines the most common apt-get and apt-cache operations into a single command, adds a progress bar, and uses colored output by default.

Both tools are part of the same apt package and share the same underlying libraries. Installing one always installs the other.

User-Facing Differences

When you run apt install in a terminal, you will notice a few things that apt-get does not do:

  • A progress bar at the bottom of the screen shows overall download and install progress.
  • Newly installed packages are highlighted in the output.
  • The number of upgradable packages is shown after apt update finishes.
  • Output is formatted with color when connected to a terminal.
  • Downloaded .deb files are deleted from /var/cache/apt/archives after a successful install.
  • On APT 3.0 and newer, long output from apt show, apt list, and apt search opens in a pager.

These features make apt more pleasant for interactive use. They also make its output less predictable for scripts, since the formatting can change between APT versions without warning. The apt man page warns about this directly: the interface is designed for end users, its behavior may change between versions, and backward compatibility is not guaranteed, so it is not recommended for scripts.

This has already happened once. APT 3.0, shipped with Debian 13 and Ubuntu 25.04 and newer, changed the layout of the apt package summary. apt-get kept the old format, so the two tools now print different text for the same install.

When you install tree with apt-get on Ubuntu 26.04, the summary looks like this:

output
The following NEW packages will be installed:
  tree
0 upgraded, 1 newly installed, 0 to remove and 23 not upgraded.
Need to get 52.7 kB of archives.
After this operation, 162 kB of additional disk space will be used.

If you run apt install tree on the same system, you get a different layout:

output
Installing:
  tree

Summary:
  Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 23
  Download size: 52.7 kB
  Space needed: 162 kB / 24.1 GB available

The information is the same, but the wording is not. If your script looks for newly installed in the output, it still works with apt-get. The same check against apt stopped matching after the upgrade to APT 3.0.

apt-get, on the other hand, is the safer automation interface. The dedicated APT tools keep backward compatibility as much as possible, which is why automation tools like Ansible, Docker, and CI pipelines use apt-get rather than apt.

Command Comparison

The table below maps the most common apt commands to their apt-get or apt-cache equivalents:

Taskaptapt-get / apt-cache
Update package indexapt updateapt-get update
Upgrade all packagesapt upgradeapt-get upgrade --with-new-pkgs
Full upgrade (may remove packages)apt full-upgradeapt-get dist-upgrade
Install a packageapt install pkgapt-get install pkg
Remove a packageapt remove pkgapt-get remove pkg
Remove with config filesapt purge pkgapt-get purge pkg
Remove unused dependenciesapt autoremoveapt-get autoremove
Search for a packageapt search keywordapt-cache search keyword
Show package detailsapt show pkgapt-cache show pkg
List installed packagesapt list --installeddpkg --list
List upgradable packagesapt list --upgradable(no direct equivalent)
Edit sources listapt edit-sources(manual file editing)

As you can see, apt merges apt-get and apt-cache into one tool and adds a few convenience commands like apt list and apt edit-sources that have no direct apt-get equivalent.

One important detail is upgrade: apt upgrade can install new dependency packages when needed, while plain apt-get upgrade holds those upgrades back. Use apt-get upgrade --with-new-pkgs when you want the closer apt-get equivalent. The apt update vs apt upgrade vs apt full-upgrade guide explains when each upgrade mode is the right choice.

Commands Only apt Provides

Newer APT releases add commands to apt that apt-get does not have. Ubuntu 26.04 ships APT 3.2 and includes the following:

  • apt why pkg - Show why an installed package is on the system
  • apt why-not pkg - Show why a package cannot be installed
  • apt history-list - List past install, upgrade, and remove transactions
  • apt history-info ID - Show the details of a transaction
  • apt history-undo ID - Undo a transaction
  • apt modernize-sources - Convert .list repository files to the deb822 .sources format

The modernize-sources command is available from APT 3.0, so it also works on Debian 13. The why and why-not commands require APT 3.1.0 or newer. The minimum version is 3.1.6 for history-list and history-info, and 3.1.7 for history-undo. Debian 13 ships APT 3.0, which does not include these newer commands.

For example, to see why the 3cpio package is installed, run:

Terminal
apt why 3cpio
output
3cpio:arm64 is selected for install because:
1. ubuntu-server:arm64 is selected for install
2. ubuntu-server:arm64 Depends mdadm
3. mdadm:arm64 Recommends finalrd (>= 3~)
4. finalrd:arm64 Recommends initramfs-tools-core
5. initramfs-tools-core:arm64 Depends 3cpio (>= 0.7)

The output follows the dependency chain one link at a time. The ubuntu-server metapackage depends on mdadm, and the chain ends with initramfs-tools-core requiring 3cpio.

If you try the same command with apt-get, it fails with:

output
E: Invalid operation why

The history commands read /var/log/apt/history.log. Both tools write to that log, so apt history-list also shows the changes you made with apt-get.

When to Use apt

Use apt for everyday interactive work in the terminal. If you are installing a package, checking for updates, or searching the repository by hand, apt is the better choice. The progress bar and cleaner output make it easier to follow what is happening.

For example, to update your package index and upgrade all packages:

Terminal
sudo apt update && sudo apt upgrade

To search for a package and then install it:

Terminal
apt search nginx
Terminal
sudo apt install nginx

When to Use apt-get

Use apt-get in shell scripts, Dockerfiles, CI pipelines, and any automated workflow. Its interface prioritizes backward compatibility, making it the safer choice for automation.

A typical Dockerfile uses apt-get with the -y flag to skip confirmation prompts:

dockerfile
RUN apt-get update && apt-get install -y \
    curl \
    git \
    && rm -rf /var/lib/apt/lists/*

The same applies to Bash scripts and configuration management tools. If the command runs without a human watching the output, use apt-get.

On Ubuntu 26.04 with APT 3.2, using apt in a script prints a warning to standard error when its output does not go to a terminal:

output
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

The warning does not stop the command. APT 3.3 removed this warning because --cli-version lets you request a specific interface version. The apt manual still recommends apt-get and apt-cache for scripts.

Advanced Operations

The commands below work with both apt and apt-get, but they are better documented and more established under apt-get. In scripts and Dockerfiles, prefer the apt-get form for consistency and stability.

  • apt-get install --no-install-recommends pkg - Install a package without pulling in recommended (but not required) dependencies. This is widely used in Docker images to keep the image size small.
  • apt-get install --allow-downgrades pkg - Allow installing an older version of a package.
  • apt-get build-dep pkg - Install all build dependencies needed to compile a package from source.
  • apt-get source pkg - Download the source package.
  • apt-get download pkg - Download the .deb file without installing it.
  • apt-get changelog pkg - Display the package changelog.
  • apt-get clean / apt-get autoclean - Clear the local package cache.

FAQ

Is apt-get deprecated?
No. apt-get is actively maintained and receives updates alongside apt. The apt man page itself points script authors to apt-get and apt-cache. Those tools keep backward compatibility as much as possible.

Can I replace all apt-get commands with apt?
For interactive terminal use, yes. For scripts, no. The apt output format is not guaranteed to remain stable, and its interface may change between versions. Stick with apt-get in any automated workflow.

Is apt install different from apt-get install?
Both run the same installation with the same dependency resolver and produce the same result. The visible difference is presentation: apt install shows a progress bar and colored output, while apt-get install prints plain, stable text. They also handle the package cache differently. apt deletes the downloaded .deb files from /var/cache/apt/archives after a successful install, and apt-get keeps them until you run apt-get clean.

Is there a difference between apt update and apt-get update?
Both refresh the package index from the same repositories. The only visible difference is that apt update also prints a summary of how many packages can be upgraded.

Is there a performance difference between apt and apt-get?
No. Both tools use the same libraries and resolve dependencies the same way. Install and download speeds are identical.

What about apt-cache? Is it still needed?
For interactive use, apt search, apt show, apt policy, and apt depends cover the most common apt-cache operations. In scripts, call apt-cache directly for the same stability reasons as apt-get.

Conclusion

Use apt when you are typing commands at a terminal, and apt-get when you are writing scripts or Dockerfiles. For a complete reference of apt subcommands, see the apt Command in Linux guide and the APT cheatsheet .

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 1000+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page