List Installed Packages with dpkg -l

Enumerate every installed package on Debian/Ubuntu with dpkg -l, filter by name and count them.

LinuxpackagesdpkglistaptLow risk
Run `dpkg -l` to list all installed packages, or `dpkg -l | grep '^ii' | grep -i nginx` to find one.

01Command

Command
$ dpkg -l

02What 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

RiskLow risk
Requirementsdpkg (preinstalled on Debian/Ubuntu/Mint). Filter with `dpkg -l | grep nginx`; count with `dpkg -l | grep -c '^ii'`; Fedora uses `dnf list installed` and Arch uses `pacman -Q`.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • dpkg(1) - Linux manual page
    Ubuntu Manpages · technical · 2026-09-17
    Evidence: 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