apt and apt-get complete cheat-sheet
What is apt ? ๐
apt (and apt-get) is a package manager. It is used in Debian Linux-based operating system and all other Linux distributions built upon Debian such as the famous Ubuntu and its flavors and built-on distros. Distributions that are built on Ubuntu are Linux Mint, Elementary OS, .. and so on.
Common usage patterns ๐
Update the local repository of packages to know the upgradeable ones:
sudo apt update
# or
sudo apt-get update
A command to upgrade programs: install upgrades for installed packages and their dependencies.
sudo apt upgrade
# or
sudo apt-get upgrade
A comprehensive chained command to update local repository of packages list, and then upgrade the upgradeable programs to their latest version releases.
sudo apt update && sudo apt upgrade -y
# or
sudo apt-get update && sudo apt-get upgrade -y
Install a program on your Ubuntu computer.
sudo apt install <package-name>
# or
sudo apt-get install <package-name>
for example: a command to install vlc program that is used to watch videos.
sudo apt install vlc
# or
sudo apt-get install vlc
A command to remove a program or uninstall a package with removing its configuration (conf).
sudo apt --purge remove <package-name>
# or
sudo apt-get --purge remove <package-name>
for example: a command to remove vlc program and its configuration files.
sudo apt --purge remove vlc
# or
sudo apt-get --purge remove vlc
Deleting all cache files for packages and programs. That path which will be removed/deleted in Ubuntu is /var/cache/apt/archives/
.
sudo apt clean
# or
sudo apt-get clean
The command to remove the packages that are automatically installed because other packages or programs depend on it. But the programs are uninstalled now, so, no need to leave these auto-installed packages hanging around clogging your disk space. So, we use this command to remove these packages.
I recommend using this command every 1 month or so, because it removes no-longer needed packages.
sudo apt autoremove
# or
sudo apt-get autoremove
Search for a program or package.
apt-cache search "package name"
for example: searching for vlc media player program.
apt-cache search vlc
If you want to search for programs and packages that their names matches a specific word, use this command.
apt-cache search --names-only <search term>
for example: searching for all programs and packages having a name includes vlc
:
apt-cache search --names-only vlc
The search results are:
$ apt-cache search --names-only vlc
gem-plugin-vlc - Graphics Environment for Multimedia - VLC support
libvlc-bin - tools for VLC's base library
libvlc-dev - development files for libvlc
libvlc5 - multimedia player and streamer library
libvlccore-dev - development files for libvlccore
libvlccore9 - base library for VLC and its modules
phonon-backend-vlc-common - Phonon VLC backends - shared files
phonon4qt5-backend-vlc - Phonon4Qt5 VLC backend
phonon4qt6-backend-vlc - Phonon4Qt6 VLC backend
python3-vlc - VLC Python bindings
vlc - multimedia player and streamer
vlc-bin - binaries from VLC
vlc-data - common data for VLC
vlc-l10n - translations for VLC
vlc-plugin-access-extra - multimedia player and streamer (extra access plugins)
vlc-plugin-base - multimedia player and streamer (base plugins)
vlc-plugin-bittorrent - Bittorrent plugin for VLC
vlc-plugin-fluidsynth - FluidSynth plugin for VLC
vlc-plugin-jack - JACK audio plugins for VLC
vlc-plugin-notify - LibNotify plugin for VLC
vlc-plugin-pipewire - PipeWire audio plugins for VLC
vlc-plugin-qt - multimedia player and streamer (Qt plugin)
vlc-plugin-samba - Samba plugin for VLC
vlc-plugin-skins2 - multimedia player and streamer (Skins2 plugin)
vlc-plugin-svg - SVG plugin for VLC
vlc-plugin-video-output - multimedia player and streamer (video output plugins)
vlc-plugin-video-splitter - multimedia player and streamer (video splitter plugins)
vlc-plugin-visualization - multimedia player and streamer (visualization plugins)
The results are monochrome! if you want to get better formatted search results with highlighted and colored texts, use this command instead.
apt search --names-only vlc
Now, the search results will be like this.
$ apt search --names-only vlc
Sorting... Done
Full Text Search... Done
gem-plugin-vlc/noble 1:0.94-8build4 amd64
Graphics Environment for Multimedia - VLC support
libvlc-bin/noble,now 3.0.20-3build6 amd64 [installed,automatic]
tools for VLC's base library
libvlc-dev/noble 3.0.20-3build6 amd64
development files for libvlc
libvlc5/noble,now 3.0.20-3build6 amd64 [installed,automatic]
multimedia player and streamer library
libvlccore-dev/noble 3.0.20-3build6 amd64
development files for libvlccore
libvlccore9/noble,now 3.0.20-3build6 amd64 [installed,automatic]
base library for VLC and its modules
phonon-backend-vlc-common/noble,noble 0.12.0-3build3 all
Phonon VLC backends - shared files
phonon4qt5-backend-vlc/noble 0.12.0-3build3 amd64
Phonon4Qt5 VLC backend
phonon4qt6-backend-vlc/noble 0.12.0-3build3 amd64
Phonon4Qt6 VLC backend
python3-vlc/noble,noble 3.0.20123-1 all
VLC Python bindings
vlc/noble,now 3.0.20-3build6 amd64 [installed]
multimedia player and streamer
vlc-bin/noble,now 3.0.20-3build6 amd64 [installed,automatic]
binaries from VLC
vlc-data/noble,noble,now 3.0.20-3build6 all [installed,automatic]
common data for VLC
vlc-l10n/noble,noble,now 3.0.20-3build6 all [installed,automatic]
translations for VLC
vlc-plugin-access-extra/noble,now 3.0.20-3build6 amd64 [installed,automatic]
multimedia player and streamer (extra access plugins)
vlc-plugin-base/noble,now 3.0.20-3build6 amd64 [installed,automatic]
multimedia player and streamer (base plugins)
vlc-plugin-bittorrent/noble 2.15-1build3 amd64
Bittorrent plugin for VLC
vlc-plugin-fluidsynth/noble 3.0.20-3build6 amd64
FluidSynth plugin for VLC
vlc-plugin-jack/noble 3.0.20-3build6 amd64
JACK audio plugins for VLC
vlc-plugin-notify/noble,now 3.0.20-3build6 amd64 [installed,automatic]
LibNotify plugin for VLC
vlc-plugin-pipewire/noble 3-3build2 amd64
PipeWire audio plugins for VLC
vlc-plugin-qt/noble,now 3.0.20-3build6 amd64 [installed,automatic]
multimedia player and streamer (Qt plugin)
vlc-plugin-samba/noble,now 3.0.20-3build6 amd64 [installed,automatic]
Samba plugin for VLC
vlc-plugin-skins2/noble,now 3.0.20-3build6 amd64 [installed,automatic]
multimedia player and streamer (Skins2 plugin)
vlc-plugin-svg/noble 3.0.20-3build6 amd64
SVG plugin for VLC
vlc-plugin-video-output/noble,now 3.0.20-3build6 amd64 [installed,automatic]
multimedia player and streamer (video output plugins)
vlc-plugin-video-splitter/noble,now 3.0.20-3build6 amd64 [installed,automatic]
multimedia player and streamer (video splitter plugins)
vlc-plugin-visualization/noble,now 3.0.20-3build6 amd64 [installed,automatic]
multimedia player and streamer (visualization plugins)
or use this command for a similar formatted results.
apt-get search --names-only vlc
show the package information or the program info:
apt-cache show <package-name>
# or
apt-get show <package-name>
# or
apt show <package-name>
show all programs in the APT repositories:
apt list
# or
apt-get list
list all installed programs and packages on your computer.
apt list --installed
# or
apt-get list --installed
list all upgradeable programs and packages.
apt list --upgradeable
# or
apt-get list --upgradeable
If you want to include an external repository, use these commands.
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:some/repository
write the repository instead of “some/repository” in the previous command.
note: you can use apt and apt-get in all commands above. You can use them both interchangeably.
Use the apt-cache
command to list all packages added to the local repository on your computer system.
apt-cache pkgnames
I hope you enjoyed reading this post as much as I enjoyed writing it. If you know a person who can benefit from this information, send them a link of this post. If you want to get notified about new posts, follow me on YouTube , Twitter (x) , LinkedIn , and GitHub .