Ubuntu – dpkg or apt-get which of the two gives a more complete result

aptdpkgpackage-managementUbuntu

I want to figure out EACH and EVERY package/software installed on an Ubuntu (14.04/16.04) system.

From my understanding and several discussions on SE and elsewhere, like unix_stack_exchange ask_ubuntu, it looks like whatever packages/software is installed on the system, dpkg will ultimately be used (be it for the package itself or it's dependencies).

  1. So does it mean that dpkg will always give a more comprehensive list
    of all the packages installed on the system (including dependencies
    etc.) than apt-get ?
  2. And is it safe to assume that dpkg can be used to list ALL the
    software (user/system/etc. applications) installed on a system ?

Best Answer

dpkg -l will always give the correct list of installed (or removed but still configured) packages. It actually uses dpkg-query to do its job, and that references the contents of /var/lib/dpkg/status which is the reference for installed packages.

apt uses the same information, but until recently didn't provide an easy way to list packages; apt list now does that, and you'll get the same results as given by dpkg -l (in a different format).

dpkg can be used to list all packages. If all the software on a system is installed using packages, then it will list all the software; but if any software has been installed manually, without a package, then it won't know about it.