
Why do Debian-based Linux distributions have apt
as well as apt-get
? Did apt
replace apt-get
or do they have different purposes? We explain the relationship between these two commands.
The Debian Package Management System
A major effort in creating a Linux distribution is designing and creating a package management system. Your users need to have a way to install and uninstall software packages. That requires software to retrieve the package files from your software repository and to install them correctly on the users’ computers.
RELATEDcURL vs. wget in Linux: What's the Difference?
This is no small undertaking. Even putting the software engineering to one side, hosting the software repositories takes time, effort, and expense. That’s one of the reasons so many “new” Linux distributions are derivations of an existing Linux distribution.
This leads to families or genealogies of Linux distributions, such as the Debian-based distributions, the Red Hat-based distributions, the Arch-based distributions, and so on.
The Debian family of distributions—including Ubuntu and all the Ubuntu-derived distributions—uses the Debian Package Manager. This uses package files with the “.deb” file extension, referred to as DEB files.DEB files are compressed files containing other archive files. The archive files contain the application’s executable files, man pages, libraries, and so on.
Installing the software from a DEB file means unpacking all these component files and placing them in the correct locations on your computer. It also requires interacting with the operating system and the desktop environment so that the application shows up in application searches and its icon can be added to docks or system menus.
The apt-get
and apt
commands both do that. But why do we have two commands for the same thing?
The Chain of Command
The package that really performs the installation is called dpkg
. It is actually a family of commands including dpkg-split
, dpkg-trigger
, and dpkg-divert
. These are called, if and as required, by the tools inthe Advanced Package Tool suite, or APT. APT is another collection of tools, including apt-get
, apt-cache
, and apt
.
The dpkg command is considered a low-level command. Beyond the simplest of interactions, it becomes very complicated with a great many options. The apt-get
command acts as a front end to the dpkg
suite of commands. This simplifies matters considerably. apt-get
is designed as a user-facing command and not a low-level background command. Even so, despite its human-facing role, another command called apt-cache
was used to display information to the user.
The apt
command provides another way to “talk” to dpkg
through a more-accessible and user-friendly command-line tool. It provides a subset of the features of apt-get
, but it is a large subset and it provides all the commonly used features and it also includes functionality from apt-cache
.
Linux Mint needs a special mention here. The Linux Mint maintainers have developed their own version ofapt
, which is a Python wrapper for apt-get
. That’s not the apt
we’re talking about here. We’re referring to the mainstream Debian apt
, which was released in 2014, and gained attention and traction in the user-verse when it was included in Ubuntu 16.04 in 2016.
The Differences Between apt and apt-get
So, dpkg
is the low-level background application. The apt-get
command is a full-featured but simplified interface to dpkg
, and apt
is a more user-friendly but slightly stripped-back version of apt-get
.
RELATEDHow To Resolve Dependencies While Compiling Software on Ubuntu
But apt-get
and apt
provide more than just an easy interface to dpkg
. They do things that dpkg
doesn’t do. They will retrieve files from repositories and will try to assist with missing dependencies and conflicts.
In turn, the apt
command does some things apt-get
doesn’t. It provides more information of the type the average user wants to see during an installation and suppresses some of the more obscure information that apt-get
displays. apt
gives superior visual feedback and uses color highlights and progress bars in the terminal window.
There are some common commands between apt
and apt-get
. All of these commands can be preceded by apt
or apt-get
and will behave the same:
- install packagename: Install a package.
- remove packagename: Remove (uninstall) a package.
- purgepackagename: Remove a package and its configuration files.
- updatepackagename: Update the repository information.
- upgrade: Update all packages.
- autoremove: Remove libraries and other packages that are no longer required.
The apt full-upgrade
option replaces the apt-get dist-upgrade
option.
These are new commands for apt
:
- apt search: Search for a package name in the repositories. This is the same as
apt-cache search
- apt show: Show information about a package. This is the same as
apt-cache show
. - apt list option: Shows lists of installed or upgradeable packages.
- apt edit-sources: Directly edits the list of repositories that
apt
searches in for packages.
Installing an Application
You can use apt search
to see whether a package exists in the repositories or to check that you’ve got the right name for the package. Let’s say you want to install Scribus but you don’t know the package name. You might try looking for scribus-desktop
.
apt search scribus-desktop
That search didn’t find anything. We’ll try again with a shorter, more generic, search clue.
apt search scribus
This returns several hits, and we can see that there is one called “scribus”, and that it certainly looks like it is the core package for the Scribus desktop publishing application. The apt show
command will give us more detail.
apt show scribus
We get a dump of information about the package, including what will be installed and a description of the software.
It also suggests other packages that might be required, depending on our needs.
To install the package we need to use sudo
.
sudo apt install scribus
The files are retrieved from the repositories. The file currently being retrieved is highlighted in brown.
When the files have been retrieved they are installed. The progress through the installation is shown as a percentage displayed in digits and as a progress bar.
Other Commands
The apt list
and apt edit-sources
commands are options in apt
that don’t exist in apt-get
.
The apt list
command can be used with the --installed
or --upgradeable
options to see the packages on your computer that are installed, and which ones could be upgraded.
To see the list of applications installed on your computer use:
apt list --installed
Scrolling through the output, we can see two entries for our newly installed Scribus application.
To see if any of the installed applications can be upgraded, use the --upgradeable
option.
apt list --upgradeable
The apt
command also provides a way for you to edit the information stored about the repositories apt
searches for packages. Only do this if you know what you’re doing.
sudo apt edit-sources
This command opens your default editor and loads the file holding the repository information.
Should I Use apt or apt-get?
The apt-get
command isn’t updated often, and that’s a good thing. It has to maintain backward compatibility. Backward compatibility isn’t such a concern for apt
. It is considered and treated as a user-facing command.
For day-to-day use, use apt
.
If you script anything to do with package installation, use apt-get
. That gives you the greatest chance of portability and compatibility in your scripts.
RELATED: The Beginner's Guide to Shell Scripting: The Basics
READ NEXT
- › How to Update PowerShell on Windows 11
- › How to List the Installed Packages on Linux
- › How to Use AppImages on Linux
- › How to Uninstall Software Using the Command Line in Linux
- › PSA: You Can Email Books and Documents to Your Kindle
- › How to Screen Record on iPhone
- › Get PC Power With Tablet Portability in the Surface Pro 9 for $200 Off
- › This Huge Curved Ultrawide Monitor From LG Is $337 Today
FAQs
What is the difference between apt vs apt-get? ›
Again, unlike the apt update command, apt-get doesn't give the total number of packages available for upgrade. Also, it doesn't include any hint on the command to list these upgradable packages. Next, we'll download and install available updates using the apt-get upgrade command.
What is the difference between apt install and apt-get in Linux? ›The old apt-get upgrade command updates all the packages which currently exist in your system. It does not install or remove the existing package on your system. However, the new apt upgrade command installs packages that were added as dependencies of upgradable packages.
Can I use apt-get instead of apt? ›apt vs apt-get Commands
Although apt commands replace commonly used apt-get and apt-cache functions, they are not backward compatible with all of them. You cannot always replace the older package managers with apt. In the table below, see the apt command for any given function, as well as which command it replaces.
apt update vs apt-get update
Both apt-get update and apt update do the same task of updating the local package cache so that your system is aware of the available package versions. Technically, there is no difference.
apt-get is a command-line tool which helps in handling packages in Linux. Its main task is to retrieve the information and packages from the authenticated sources for installation, upgrade and removal of packages along with their dependencies.
What does apt in apt-get stand for? ›What Is apt-get and What Is It Used For? apt-get is a command line tool for interacting with the Advanced Package Tool (APT) library (a package management system for Linux distributions). It allows you to search for, install, manage, update, and remove software. The tool does not build software from the source code.
Which Linux uses apt-get? ›On Linux operating systems that use the APT package management system, the apt-get command is used to install, remove, and perform other operations on installed software packages. The apt-get command, and other core APT utilities, are available by default in the Debian, Ubuntu, and Linux Mint operating systems.
Does apt-get require sudo? ›There are instances where you don't need sudo at all, like using apt-get download which downloads a package to your current directory, apt-get source which downloads the debian sources files to your current directory, changelog which downloads and prints the changelog of a given package, and any command which has the ...
Does Ubuntu still use apt? ›Advanced Packaging Tool – APT
The apt command is a powerful command-line tool, which works with Ubuntu's Advanced Packaging Tool (APT). It installs new software packages, upgrades existing software packages, updates the package list index, and even upgrades the entire Ubuntu system.
The sudo apt-get update command is used to download package information from all configured sources. The sources often defined in the /etc/apt/sources. list file and other files located in /etc/apt/sources.
Is apt-get obsolete? ›
apt-get can be considered as a low-level front-end tool for the APT package system with backward compatibility. There is no official document says that apt-get is deprecated and can no longer be used hence use the apt-get based on your requirement.
Are yum and apt-get the same? ›APT: What Are the Differences? YUM and APT offer the same core functionalities when it comes to installing packages. Both tools keep the information in a database and provide the same basic command-line features.
Can I use yum instead of apt-get? ›Installing is basically the same, you do 'yum install package' or 'apt-get install package' you get the same result. Yum automatically refreshes the list of packages, whilst with apt-get you must execute a command 'apt-get update' to get the fresh packages. Another difference is upgrading all the packages.
What is sudo in Linux? ›Sudo stands for either "substitute user do" or "super user do" and it allows you to temporarily elevate your current user account to have root privileges.
How to install all commands in Linux? ›install command is used to copy files and set attributes. It is used to copy files to a destination of the user's choice, If the user want to download and install a ready to use package on GNU/Linux system then he should use apt-get, apt, yum, etc depending on their distribution.
What is sudo used for? ›Sudo (superuser do) is a utility for UNIX- and Linux-based systems that provides an efficient way to give specific users permission to use specific system commands at the root (most powerful) level of the system. Sudo also logs all commands and arguments.
How to install packages with apt-get? ›When the package is directly available in default repositories, you can install it by running the “apt-get” command with the “install” option. Note : you will need sudo privileges in order to install new packages on your system. You may also be asked if you accept to install this package on your system.
Is apt a package manager? ›Apt is a Linux package management tool used on Ubuntu and a variety of other Linux distributions. Introduced in 1998, apt has become a widely supported, popular option to install, update and remove Linux software. Apt manages Debian packages, known as debs.
What's the difference between apt and dpkg? ›APT is a front-end to dpkg that is more user-friendly than the earlier select front-end. While dpkg handles individual package activities, APT handles package relationships (particularly dependencies), as well as the sourcing and administration of higher-level versioning choices (release tracking and version pinning).
Should I use apt or apt-get to install? ›As an average Linux user, you should use apt when you're installing packages or updating your system, etc. If you're a developer, apt-get is what you'll use in the scripts or programs you create.
What is the difference between apt-get install and pip install? ›
pip is used to download and install packages directly from PyPI. PyPI is hosted by Python Software Foundation. It is a specialized package manager that only deals with python packages. apt-get is used to download and install packages from Ubuntu repositories which are hosted by Canonical.
What does apt-get install mean in Linux? ›Advanced Package Tool, more commonly known as APT, is a collection of tools used to install, update, remove, and otherwise manage software packages on Debian and its derivative operating systems, including Ubuntu and Linux Mint.
What is the difference between apt and apt-get in Raspbian? ›Re: " apt " vs " apt-get "
The main difference appaears to be the default parameters -- apt is optimised for interactive use, apt-get remains for use in scripts.