apt command
Install, update and remove packages on Ubuntu and Debian.
- Package management
- Package apt
- 11 options · 11 examples
Syntax
apt [options] command [package…]Provided by the apt package. Run man apt for the full manual.
Common options
| Option | What it does |
|---|---|
update | Refresh the package lists |
upgrade | Upgrade installed packages |
full-upgrade | Upgrade, adding or removing packages if needed |
install | Install packages |
remove | Remove packages, keep config |
purge | Remove packages and config |
autoremove | Remove unused dependencies |
search | Search package names and descriptions |
show | Package details |
list --installed | Installed packages |
-y | Answer yes to prompts |
Examples
Refresh the package lists
sudo apt updateUpgrade everything
sudo apt update && sudo apt upgrade -yInstall a package
sudo apt install nginxInstall a local .deb file
sudo apt install ./package.debRemove a package
sudo apt remove apache2Remove with its config
sudo apt purge apache2Clean unused dependencies
sudo apt autoremoveSearch for a package
apt search redisShow package details
apt show php8.4List installed packages
apt list --installedList available upgrades
apt list --upgradable
No example matches. Check the options table or search the guides.
apt guides
- 12 Apt Command Examples in Ubuntu & Debian Linux Linux Commands · Updated Apr 2025
- What does the apt update Command Do? Linux Commands · Updated Apr 2025
- How to Exclude Packages from Apt-Get Upgrade in Ubuntu Linux · Updated Apr 2025
