apt
Advanced Package Tool. Package management for Debian/Ubuntu based distros.
Update Package Lists
Update the list of available packages.
sudo apt update
Upgrade Packages
Upgrade all installed packages.
sudo apt upgrade
Upgrade with automatic conflict resolution.
sudo apt full-upgrade
Install Package
Install a new package.
sudo apt install [package]
Install without prompts.
sudo apt install -y [package]
Remove Package
Remove a package (keep configuration files).
sudo apt remove [package]
Remove package and configuration files.
sudo apt purge [package]
Remove Unused Packages
Remove packages that were automatically installed and are no longer needed.
sudo apt autoremove
Search for Package
Search for packages by name or description.
apt search [package]
Show Package Information
Display detailed information about a package.
apt show [package]
List Packages
List all installed packages.
apt list --installed
List upgradable packages.
apt list --upgradable
Clean Cache
Remove downloaded package files.
sudo apt clean
Remove old package files only.
sudo apt autoclean
Fix Broken Dependencies
Attempt to fix broken dependencies.
sudo apt --fix-broken install
Reconfigure Package
Reconfigure an already installed package.
sudo dpkg-reconfigure [package]
APT Mark
Hold Package Version
Prevent a package from being upgraded.
sudo apt-mark hold [package]
Unhold Package
Allow a held package to be upgraded again.
sudo apt-mark unhold [package]
List Held Packages
Show all packages that are held.
apt-mark showhold
Mark as Manually Installed
Mark a package as manually installed (won't be removed by autoremove).
sudo apt-mark manual [package]
Mark as Automatically Installed
Mark a package as automatically installed.
sudo apt-mark auto [package]
Repository Management
Add Repository
sudo add-apt-repository ppa:repository/name
sudo apt update
Remove Repository
sudo add-apt-repository --remove ppa:repository/name
Check for Updates
Check if updates are available without installing.
apt list --upgradable
Download Package Without Installing
Download package file without installing.
apt download [package]
Common Options
| Option | Description |
|---|---|
-y | Assume yes to prompts |
--no-install-recommends | Don't install recommended packages |
--reinstall | Reinstall package |
-s | Simulate (dry run) |
-q | Quiet mode |