apt-get
Quick Reference
Command Name:
apt-get
Category:
package management
Platform:
linux
Basic Usage:
Common Use Cases
- 1
Software installation
Install software packages from repositories with dependency handling
- 2
System updates
Keep the system up-to-date with security patches and bug fixes
- 3
Package removal
Safely remove unwanted software while maintaining system integrity
- 4
Source code retrieval
Download source code of packages for inspection or modification
Syntax
apt-get [options] command
Options
Option | Description |
---|---|
-h, --help | Show help message and exit |
-v, --version | Show the program version |
-y, --yes, --assume-yes | Automatically answer yes to all prompts |
--assume-no | Automatically answer no to all prompts |
-q, --quiet | Quiet mode; produce output suitable for logging |
-d, --download-only | Download packages only, don't install or unpack |
-s, --simulate | Simulate actions but don't actually change the system |
--no-install-recommends | Don't install recommended packages |
--install-suggests | Consider suggested packages as dependencies |
-f, --fix-broken | Attempt to fix a system with broken dependencies |
-m, --ignore-missing | Ignore missing packages, proceed with installation |
--purge | Use purge instead of remove for packages |
--reinstall | Reinstall packages even if already installed |
--list-cleanup | Clean up obsolete files from /var/lib/apt/lists |
-t, --target-release | Control the default release to install packages from |
--auto-remove, --autoremove | Remove automatically installed packages no longer needed |
--allow-unauthenticated | Ignore missing or invalid authentication keys |
--no-upgrade | Don't upgrade packages |
--only-upgrade | Only upgrade already installed packages |
Examples
How to Use These Examples
The examples below show common ways to use the apt-get
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
# Update package lists sudo apt-get update
Advanced Examples:
# Upgrade the entire system including package removals if needed sudo apt-get dist-upgrade