๐Ÿงฐ 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.