Skip to content

Everyday package management commands for Debian and Ubuntu using APT

Core Package Management

Install software.

apt install

Remove (uninstall) software.

apt remove

Upgrade software.

apt upgrade

Downgrade software.

apt install <package>=<version>

Reinstall software.

apt reinstall

Remove software and install another in one transaction (using chaining).

apt install <package1> && apt remove <package2>

Remove all unneeded packages originally installed as dependencies.

apt autoremove

Install build dependencies for a package or spec file.

apt build-dep

Install debuginfo packages.

apt install <package>-dbgsym

Change the reason for an installed package (mark as auto or manual).

apt-mark auto <package>

apt-mark manual <package>

Search and Information

Search for software matching all specified strings.

apt search

List packages depending on their relation to the system with additional details.

apt show

List packages depending on their relation to the system.

apt list

Find what package provides the given value.

apt-file search

Search for packages matching various criteria (cache information).

apt-cache showpkg

List groups of installed packages not required by other installed packages.

apt-mark showauto

Show package changelogs.

apt changelog

Print a list of unresolved dependencies for repositories.

apt-get check

System Updates and Upgrades

Check for available package upgrades.

apt list --upgradable

Upgrade or downgrade installed software to the latest available versions (handles changing dependencies).

apt full-upgrade

Prepare the system for an upgrade to a new release.

do-release-upgrade

Determine whether the system or systemd services need restarting.

needrestart

Repository and Configuration Management

Manage repositories (add).

add-apt-repository

Manage Copr-equivalent repositories (Personal Package Archives).

add-apt-repository ppa:<name>

Generate the metadata cache.

apt update

Remove or expire cached data.

apt clean

Transactions and History

Manage transaction history (viewing log).

cat /var/log/apt/history.log