wEEK 12
Software Management
This week focuses on how Linux manages software packages—the modular building blocks of any system. Every command you’ve used so far came from a package managed by a tool called APT (Advanced Package Tool).
APT handles three critical jobs:
It keeps a catalog of available software (the package index).
It installs and removes packages with all their dependencies.
It helps users inspect and explore what’s already on the system.
In this lesson, you’ll learn to use the APT package manager, following the six-step M-A-N-A-G-E framework.
M-A-N-A-G-E (Manage → Ask → Name → Add → Get rid → Explore).
M — Manage Package Index
APT maintains a local index of available packages. This index must be refreshed frequently to ensure your system knows about the latest software, security patches, and updates.
| Command | Purpose | Description |
|---|---|---|
sudo apt-get update | Refresh package list | Synchronizes your local repository index with online sources. |
sudo apt-get upgrade | Apply safe upgrades | Updates all installed packages to their newest compatible versions. |
sudo apt-get dist-upgrade | Full distribution upgrade | Handles kernel or dependency changes that require more complex updates. |
sudo apt-get autoclean | Clean cache | Removes old, unused package files from /var/cache/apt/archives. |
sudo apt-get autoremove | Remove orphans | Deletes libraries and packages that were automatically installed but are no longer needed. |
Updating the index keeps your system aware of available software versions—much like refreshing an app store before installing anything.
A — Ask About Packages
APT can search for software without installing it. This allows you to explore available tools safely and see what’s maintained in your repositories.
| Command | Purpose | Description |
|---|---|---|
apt-cache search git | Search repository | Finds packages related to a keyword such as “git.” |
apt search editor | Modern search | A cleaner, user-friendly search interface. |
apt-cache showpkg nginx | Show relationships | Displays dependency and reverse dependency information. |
apt-cache policy curl | Check version source | Shows which repository a package comes from and available versions. |
Searching lets you “ask” the system what software exists. It encourages exploration before committing to install anything.
N — Name Details
Before installing a package, you should know exactly what it is. APT and dpkg provide detailed metadata that describes each package’s role, dependencies, and maintainers.
| Command | Purpose | Description |
|---|---|---|
apt show git | Display package info | Shows full description, dependencies, version, and maintainer. |
dpkg -s bash | Check installed package | Displays local metadata for already installed software. |
apt-cache depends git | Show dependencies | Lists other packages required for operation. |
apt-cache rdepends git | Show reverse dependencies | Displays which packages depend on it. |
Reading package details helps you understand what’s being installed and ensures you don’t remove something critical to the system.
Navigate the tree
A — Add Software (Safe Install)
Installation through APT is reliable because it resolves dependencies automatically and verifies digital signatures.
| Command | Purpose | Description |
|---|---|---|
sudo apt-get install -y tree | Install package | Downloads and installs “tree” without confirmation prompts. |
sudo apt-get install -y htop curl | Install multiple | Installs more than one package at the same time. |
sudo apt-get install --reinstall -y tree | Reinstall | Reinstalls a package if it’s corrupted. |
tree --version | Verify version | Confirms that the software was successfully installed. |
which tree | Locate binary | Shows the installation path of the command (usually /usr/bin/tree). |
Adding software expands your environment safely. APT checks authenticity, integrity, and dependencies automatically.
G — Get Rid of It
Removing software cleanly is as important as installing it. Proper removal helps keep your system lean and avoids conflicts or wasted space.
| Command | Purpose | Description |
|---|---|---|
sudo apt-get remove -y tree | Uninstall | Removes program files but leaves configuration data intact. |
sudo apt-get purge -y tree | Full removal | Deletes both the program and its configuration files. |
sudo apt-get autoremove -y | Dependency cleanup | Removes leftover dependencies that are no longer needed. |
sudo apt-get clean | Clear cache | Deletes downloaded package files from the local cache. |
dpkg -l | grep tree | Verify removal | Checks if the package is still listed as installed. |
E — Explore Installed Packages
APT tracks every installed package, creating a transparent record of your system’s contents. Exploring this list helps you understand how your environment is built.
| Command | Purpose | Description |
|---|---|---|
apt list --installed | less | View installed packages | Displays all installed packages with scrolling navigation. |
dpkg -l | Local package list | Prints a concise summary of installed packages. |
dpkg -L bash | List package files | Shows every file installed by a package. |
dpkg -S /usr/bin/ls | Identify package by file | Finds which package owns a particular file. |
apt-mark showmanual | User-installed list | Lists packages that were installed manually. |
apt-mark showauto | Auto-installed list | Lists packages installed automatically as dependencies. |
This concludes Lecture 12. Please return to Blackboard to access the Week 12 materials.