The command we need to use is dpkg –get-selections, which will give us a list of all the currently installed packages.

The full list can be long and unwieldy, so it’s much easier to filter through grep to get results for the exact package you need. For instance, I wanted to see which php packages I had already installed through apt-get:

For extra credit, you can find the locations of the files within a package from the list by using the dpkg -L command, such as:

Now I can take a look at the gd.ini file and change some settings around…