Advanced Packaging Tool

Introduction

This document contains frequently used command and the corresponding used cases for package management software Advanced Packaging Tool (APT). For simplification, all the variables are written in parenthesis, e.g. (package), (version). The optional parameters are written in sqaure brackets, e.g. [—versions], [—mixed]

 

Table of Content

 

Environment Setting

Back to Top

Update APT package index

sudo apt update

Show all personal package archives (PPA) repository APT has tracked

apt policy

Track new PPA repository

sudo apt-get install software-properties-common # if add-apt-repository is not available
sudo add-apt-repository ppa:(PPA repository/PPA)

Removed tracked PPA repository

sudo add-apt-repository --remove ppa:(PPA repository/PPA)

 

Package Explorer

Back to Top

Show installed packages

apt list --installed

Show outdated packages

apt list --upgradable

Search available packages in tracked PPA repository

apt search [--names-only] (package/regex) 

Search available packages (with all available versions) in APT repostitory

apt list --all-versions (package)

 

Package Installation

Back to Top

Install specific package

sudo apt install (package)[=(version)]

Reinstall specific package

sudo apt install [--reinstall] (package)

Uninstall specific package (but keep configuration files)

sudo apt remove (package)

Uninstall specific package (also remove configuration files)

sudo apt purge (package)

 

Upgrade Installed Package

Back to Top

Upgrade specific package

sudo apt upgrade [package]

Upgrade all packages except for marked packages

sudo apt upgrade

Show marked packages

sudo apt-mark showhold

Disallow package to be upgraded

sudo apt-mark hold (package)

Allow package to be upgraded

sudo apt-mark unhold (package)

Related articles

Introduction to Linux

An operating system sits between users and hardware. It manages memory, processes, files, and devices while exposing a graphical or command-line interface. - Linux - iOS - Android - macOS - Windows…

Training

Poetry

This file defines project metadata and dependencies. This file pins the exact dependency versions used in the project for reproducibility. --- --- Poetry is ideal for clean, reproducible Python pro…

Training

Python

In Python, values such as integers, strings, lists, and functions are all objects. They have types and methods, which is different from C++ primitive values. --- Lists are ordered, mutable sequence…

Training

Git

Git is a distributed version control system (DVCS) used to: - track changes to files over time - collaborate with multiple people on the same project - manage branches independently - sync code wit…

Training