Gentoo Background

Ubuntu Linux APT Package Management

Enhance your Ubuntu Linux experience with this comprehensive guide to APT package management.

Discover efficient techniques for updating, upgrading, installing, removing, and managing packages on your Ubuntu system. Master advanced APT commands and optimize your package management workflow effortlessly.

Fix Broken install packages

apt --fix-broken install

Fix missing confiugration after manually deleted a folder

apt-get purge --auto-remove syslog-ng -y
apt-get install --reinstall syslog-ng -y

Update and Upgrade Packages

apt update
apt upgrade

Search for Packages

apt search <package>

Install a Package

apt install <package_name>

Remove a Package

apt remove <package_name>

Purge a Package (Remove with Configuration Files)

apt purge <package_name>

Search for Packages by Name

apt search <package_name>

Show Package Information

apt show <package_name>

List Installed Packages

apt list --installed

List Upgradable Packages

apt list --upgradable

Check for Broken Dependencies

apt check

Autoremove Unused Packages

apt autoremove

Clean Downloaded Package Files

apt clean

Clean and Remove Cached Package Files

apt autoclean

View the Package Repository Sources

cat /etc/apt/sources.list

Add a Repository

add-apt-repository <repository_url>

Remove a Repository

add-apt-repository --remove <repository_url>

Upgrade Installed Packages

apt upgrade

Full System Upgrade (Distro Upgrade)

apt dist-upgrade

Check for Held Back Packages

apt-mark showhold

Hold a Package to Prevent Upgrades

apt-mark hold <package_name>

Unhold a Held Package

apt-mark unhold <package_name>

Find which Package Provides a File

apt-file search <file_name>

Install apt-file (if not already installed)

apt install apt-file
apt-file update

Check the Version of Installed Packages

dpkg -l | grep <package_name>

Reconfigure an Installed Package

dpkg-reconfigure <package_name>

Check Available Package Updates

apt list --upgradable

Install Security Updates Only

unattended-upgrades --dry-run --debug

Lock/Unlock a Package Version

apt-mark hold <package_name>
apt-mark unhold <package_name>

Show Package Dependencies

apt-cache depends <package_name>

View APT History

cat /var/log/apt/history.log

Install Useful Packages

apt-get install -qqy apt aptitude pigz unrar unzip p7zip-full xz-utils parallel binwalk build-essential \
cmake make autoconf automake pkg-config libssl-dev git tcl tcllib apache2 mysql-server libmysqlclient-dev \
python3 python3-pip perl rustc g++ golang-go maven lua5.3 liblua5.3-dev openssh-server sshfs vim nano \
libgtk-3-dev binutils gcc-multilib gdb debootstrap schroot libjson-c-dev libyaml-dev libxml2-dev \
libpcre3-dev libsqlite3-dev libpq-dev libncurses5-dev libevent-dev libreadline-dev libglib2.0-dev \
libsqlite3-dev lftp ftp npm nodejs gnutls-dev libgnutls30 libgnutls-openssl-dev libfuse-dev apktool \
android-sdk default-jre default-jdk openjdk-11-jre openjdk-11-jdk libssl-dev software-properties-common \
python3-software-properties ssmtp mailutils cryptsetup aespipe ca-certificates gnupg adb fastboot \
iperf3 pciutils lsof strace libapache2-mod-php net-tools docker-compose syslog-ng figlet \
inxi dropbear-initramfs initramfs-tools busybox meson ninja-build squashfuse squashfs-tools-ng \ 
squashfs-tools squashfs-mount translate-shell shellcheck screen ripgrep tcl-dev