How to List the Installed Packages in Ubuntu?

Robert Torok July 15, 2018
How to List the Installed Packages in Ubuntu?

If you want to quickly retrieve the installed packages on your Ubuntu system, the following command may help you:

$ dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' | sort -k1 -n | tail -10
    187570	libwine
    196212	chromium-browser
    217038	code
    229577	dotnet-sdk-2.1
    234043	google-earth-pro-stable
    238217	skypeforlinux
    264118	openjdk-9-jre-headless
    271097	linux-firmware
    277498	brackets
    321330	openjdk-11-doc

This command actually prints the top 10 largest packages.

dpkg-query, as its name suggests, it queries the installed packages on your system. The —showformat parameter defines what properties of the installed packages should be listed. In our case, we're interested in the packages' size and name.

This is then sorted by the sort tool. The parameter -k1 means that the first column will be sorted, the other parameter -n tell that this field should be interpreted as a numeric value.

The last command tail instructs to show only the last 10 results.