linux-cookbook/src/apt.md

2.5 KiB

APT package manager

APT (Advanced Package Tool) is the main command-line package manager for Debian, Ubuntu and their derivatives (including TUXEDO OS, Linux Mint, Pop!_OS, etc.).

It provides a set of command-line tools to download, install, remove, upgrade, configure and manage software packages on Debian and Ubuntu systems.

Basic APT commands

Although grafical frontends like Synaptic exist, it's always good to know the basic commands of the apt command-line interface.

Updating the repository index

sudo apt update

Installing a package

sudo apt install <package>

Reinstalling a package

sudo apt reinstall <package>

Removing a package

sudo apt remove <package>

Upgrading packages

sudo apt upgrade  # upgrades all packages
sudo apt upgrade <package>  # upgrades only a specific package

Listing all installed packages

apt list --installed

Searching for packages

apt search <string>  # searches in package names and descriptions

or:

apt list | grep <string>

Synaptic package manager

Synaptic is a graphical package management program for APT.

To install Synaptic:

sudo apt install synaptic

Note: on TUXEDO OS, Synaptic is preinstalled. You can find it in the applications menu, under the "Settings" category.

Editing APT sources

APT downloads packages from one or more software repositories (sources). The specific repositories configured on your machine affect:

  • What software packages are available for download
  • What versions of packages are available
  • Who packages the software

The main APT sources configuration file is at /etc/apt/sources.list. To add custom sources, or edit the existing ones, you can edit this file (with root privileges) or create separate *.list files under the directory /etc/apt/sources.list.d/.

Further reading