/codes/apt/dpkg-package-states
dpkg -l status codes: ii, rc, un, iU, iF explained
The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
- tool
- apt
- versions
- dpkg 1.x
- os
- linux
Each line of dpkg -l starts with a status column of two or three characters. The first character is what you asked for (desired action), the second is the package's current state, and an optional third flags an error. ii means "should be installed, is installed"; rc means "removed, but configuration files are still there".
First character: desired action
| Code | Meaning |
|---|---|
| u | unknown |
| i | install |
| h | hold (do not change) |
| r | remove (keep configuration) |
| p | purge (remove including configuration) |
Second character: current state
| Code | Meaning |
|---|---|
| n | not installed |
| c | configuration files only |
| H | half-installed (installation started, not finished) |
| U | unpacked, not configured |
| F | half-configured (configuration failed) |
| W | triggers awaited |
| t | triggers pending |
| i | installed |
Third character: error flag
R means reinstallation required; the package is broken and must be reinstalled.
Common combinations
dpkg -l | grep '^rc' | awk '{print $2}' # leftovers of removed packages
dpkg -l | grep '^rc' | awk '{print $2}' | xargs -r sudo dpkg --purge
dpkg -l | grep -E '^.[HUFWt]' # packages in an unfinished state
sudo dpkg --configure -a # finish configuring themSources
Related pages
commands · aptList installed packages with apt and dpkgList installed packages on Debian and Ubuntu with apt list --installed, show manually installed ones with apt-mark showmanual, and export the list to reuse.errors · aptapt: Could not get lock /var/lib/dpkg/lock-frontendapt fails with Could not get lock /var/lib/dpkg/lock-frontend while another apt, dpkg or unattended-upgrades runs. Wait for it; never delete the lock.compare · aptapt vs apt-get: which one to useapt is the friendlier front end for interactive use, with progress bars, apt list and search; apt-get keeps a stable interface, so scripts should use it.