List Installed Packages with dpkg -l
Enumerate every installed package on Debian/Ubuntu with dpkg -l, filter by name and count them.
01Command
$ dpkg -l02What it does
Each row starts with a two-letter status — 'ii' means properly installed, 'rc' means removed but config files remain, and 'iU' signals an unpacked-but-unconfigured package that needs attention. `dpkg -l 'firefox*'` accepts glob patterns directly without grep. For scripting, prefer `dpkg-query -W -f='${binary:Package} ${Version}\n'` which gives clean output, and `dpkg --get-selections > backup.txt` is the classic way to snapshot a package list for restoring a machine.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- dpkg(1) - Linux manual pageEvidence: dpkg -l lists packages matching a pattern with their status; the 'ii' status flag means installed, and dpkg-query offers machine-readable output.
Last verified: 2026-09-18 · Category: System & Settings
06Related solutions
dpkg -S tells you which installed package a file came from; dpkg -L lists everything a package put on disk.
autoremove deletes no-longer-needed dependency packages, and clean wipes the downloaded .deb cache in /var/cache/apt/archives.