๐งฐ Modern APT Commands Cheatsheet (2025 Edition)
This is a practical and SEO-optimized reference guide for safe, essential APT package manager commands on modern Debian-based Linux systems like Ubuntu.
๐ฅ 1. Update Package List
sudo apt update
Fetches the latest list of available packages.
๐ 2. Upgrade Installed Packages
sudo apt upgrade
Safely upgrades all packages without removing anything.
๐ง 3. Full Upgrade
sudo apt full-upgrade
Handles changing dependencies by removing/installing packages.
๐งน 4. Autoremove Unused Packages
sudo apt autoremove
Removes unnecessary dependencies no longer needed.
๐ฟ 5. Purge Autoremove
sudo apt autoremove --purge
Same as above but also removes leftover config files.
๐งผ 6. Clean Cached Packages
sudo apt clean
Clears cached .deb files in /var/cache/apt/archives
.
๐ฆ 7. Install Package
sudo apt install <package>
Installs any package by name.
โ 8. Remove Package
sudo apt remove <package>
Removes a package but keeps configuration files.
๐ฅ 9. Purge Package
sudo apt purge <package>
Removes both package and its config files.
๐ 10. Purge + Autoremove
sudo apt purge --auto-remove <package>
Completely wipes the package and unused dependencies.
๐ ๏ธ 11. Fix Broken Installs
sudo apt --fix-broken install
Tries to fix broken or incomplete installs.
๐ 12. Search for Package
apt search <package>
Find packages by name or keyword.
๐ 13. Show Package Info
apt show <package>
Shows package details, dependencies, version, etc.
๐ 14. List Installed Packages
apt list --installed
Displays all installed packages on your system.
๐ซ 15. Hold a Package
sudo apt-mark hold <package>
Prevents the package from being upgraded.
โ 16. Unhold a Package
sudo apt-mark unhold <package>
Allows the package to be upgraded again.
๐ 17. View Install History
cat /var/log/apt/history.log
Log of installs, upgrades, and removals.
โจ Built for modern Ubuntu/Debian systems. Don't use ancient apt-get
unless you're in a script or on a fossilized distro.
๐ง Visit GitHub Page or star the GitHub Repo to support this project.