Package Management In Debian(.deb) Based Linux Distributions

Software Package

A software package is an archive file of compiled and built source code with necessary metadata for its deployment. The metadata of the package consist of dependencies, package version, and about the software. For example – the .deb packaging is used for Debian based Linux Distributions while .rpm packaging is used in Red Hat, Fedora, and other related distributions.

Package Manager

A package manager is a collection of software tools that automate the process of installation, configuration, up-gradation, and removal of software packages in an operating system. It keeps the information about dependencies and software version to avoid the inconsistency and version mismatch. These are designed to increase the user-friendliness of the system as it removes the need for manual installation, update, and removal of a software package.

Advanced Packaging Tools (apt)

The apt provides a command-line interface to interact with core libraries of the operating systems for the installation, up-gradation, and removal of a package. It can be considered as the front end to dpkg which is used in Debian, Ubuntu, and its derived Linux distributions. A .deb packaged software is used in these systems. Some important commands related to apt are given below:

apt-get Commands-

apt-get install package_name – This command is used to install package(s) along with dependencies
apt-get remove package_name – Used to remove the installed packages
apt-get autoremove – Remove the dependencies that are no longer needed
apt-get clean – Remove the downloaded software files that are already installed
apt-get purge package_name – This will remove the software and clean modified user configuration files that were left after the removal of software.
apt-get update– Used to download the package information from the all configured sources.
apt-get upgrade – Used to install available upgrades of all packages currently installed on the system form the source configured via source.list which resides in /etc/apt directory it should run after the update.

apt-cache Commands-

apt-cache search package_name – Search performs a full-text search on all available package lists and shows a list of related packages and their description
apt-cache show package_name – Shows description of dependencies, version, size, origin, etc.
apt-cache pkgnames – Shows the complete list of installed software on the system
apt-cache depends package_name – Shows the listing of each dependency a package has and all the possible other packages that can fulfill that dependency
apt-cache rdepends package_name – Shows a listing of each reverse dependency a package has.

Difference between apt and apt-get commands-

The first version of apt binary was introduced in Debian Jessie(version 8), the functionality of apt-get and apt-cache get merged into the new apt tool which has fancier colored output and is more pleasant for the end-users. That means some popular commands like apt-get update, apt-get install, apt-cache search or apt-get remove now can also be simply called the apt update, apt install, apt search, or apt remove. The following is an overview of the old and their equivalent new commands:


apt-get update apt update
apt-get upgrade apt upgrade
apt-get dist-upgrade apt full-upgrade
apt-get install package_name apt install package_name
apt-get remove package_name apt remove package_name
apt-get autoremove apt autoremove
apt-cache search string apt search string
apt-cache policy package_name apt list -a package_name
apt-cache show package_name apt show package_name
apt-cache showpkg package_name apt show -a package_name

Please note that for usage in scripts or advanced use cases, apt-get is still preferable or needed. It is the preferred program for package management from console to perform system installation and major system upgrades.

Debian Package(dpkg)

It is also used to install, remove, and perform such other operations on .deb file. The dpkg is a low-level tool it works with downloaded files unlike apt which can fetch the packages from a remote location and can resolve dependencies.

dpkg Commands-

dpkg -i downloaded_package_name.deb – Install a .deb file that is stored in systems memory.
dpkg --list string_to_search – list the related packages that are installed on a system
dpkg --unpack package_file_name – Unpack the downloaded file but not configure it
dpkg --configure package_name – Configure a package which has been unpacked but not yet configured
dpkg --reconfigure package_name – It will reconfigure the installed package.

For more such command you can access the dpkg manual page in your terminal by using $man dpkg command.


Aptitude is a high-level interface to the package manager. It provides a terminal menu interface that is not provided by apt. It is a transaction based package management service. If you consider only command-line interfaces apt and aptitude are quite similar to each other. Installation, removal, up-gradation of a package can be performed with a single key command. To access the aptitudes terminal menu type the command $sudo aptitude into your terminal and press the enter.

Now the terminal menu will look something like this-

To install updates select from the menu and press u, to quit from the aptitude menu press q and select yes it will bring you to the command prompt.

Exit mobile version