apt Basics
apt is the package manager for Debian, Ubuntu, and derivatives. You'll use it constantly.
Update Package Lists
Before installing anything, update your package index:
This downloads the latest package information from repositories. It doesn't install anything yet.
Always Update First
Running apt install without apt update might install outdated versions or fail to find packages.
Install Packages
Install multiple packages at once:
Skip Confirmation
-y automatically answers "yes" - useful in scripts.
Remove Packages
This removes the package but keeps configuration files.
Remove with Config Files
Use purge when you want a clean removal.
Clean Up Unused Dependencies
Removes packages that were installed as dependencies but are no longer needed.
Upgrade Packages
update vs upgrade
apt update- Downloads package information (what's available)apt upgrade- Actually installs newer versions
Full Upgrade
full-upgrade can remove packages to resolve conflicts. Regular upgrade never removes anything.
Check If Package Is Installed
The Classic Combo
Run this regularly to keep your system current.
What's the difference between 'apt remove' and 'apt purge'?
Quick Reference
| Command | Purpose |
|---|---|
apt update | Refresh package lists |
apt upgrade | Upgrade installed packages |
apt install pkg | Install a package |
apt remove pkg | Remove (keep configs) |
apt purge pkg | Remove completely |
apt autoremove | Clean unused deps |
apt list --installed | Show installed |
Key Takeaways
- Always
apt updatebefore installing apt install packageto installapt removekeeps configs,apt purgeremoves allapt autoremovecleans up orphaned dependenciesapt update && apt upgradekeeps system current
Next: finding the right packages to install.