List installed packages in Ubuntu or Debian
In some situations we need to know which packages we have installed in a Debian or Ubuntu system. In that case, we can use the tool dpkg, which will give us the information we need. dpkg Next command will give us the current packages installed with different states: dpkg --get-selections The states we can have are: install: The package is selected for installation. hold: A package marked to be on hold is not handled by dpkg, unless forced to do that with option –force-hold. deinstall: The package is selected for deinstallation (i.e. we want to remove all files, except configuration files). purge: The package is selected to be purged (i.e. we want to remove everything from system directories, even configuration files). If we want to filter packages, we can combine dpkg tool with grep tool. Here an example to filter the packages related with nginx: ...