Sometimes you just can’t remember what packages you’ve already installed, or what version you are currently running. Thankfully you can quickly find out this information from the command line.
$ dpkg --get-selections acl install acpi-support install acpid install adduser install alacarte install alsa-base install alsa-utils install anacron install apmd install apparmor install apparmor-utils install apport install apport-gtk install apt install apt-transport-https install apt-utils install apt-xapian-index install aptitude install apturl install
You’ll find that there is far too much information returned by this command and the only way to find exactly what you need is to grep it with a specific query. So for example if you were looking to find out what Python packages you had installed on that system you could use this command:
$ dpkg --get-selections | grep python libpython2.6 install python install python-apport install python-apt install python-brlapi install python-cairo install python-central install python-cups install python-cupshelpers install
If you read the man pages on dpkg you’ll find there are many other useful commands you utilize. If you’re trying to track down the location of a package you can use the following command:
$ dpkg -L firefox /. /usr /usr/share /usr/share/doc /usr/share/doc/firefox /usr/share/doc/firefox/copyright /usr/share/doc/firefox/changelog.Debian.gz
This will give you a good idea of where you need to look if you’re trying to find some config files.
A seasoned Senior Solutions Architect with 20 years of experience in technology design and implementation. Renowned for innovative solutions and strategic insights, he excels in driving complex projects to success. Outside work, he is a passionate fisherman and fish keeper, specializing in planted tanks.
You can also use dpkg -l ‘*python*’ instead of piping to grep….
You’re a saviour, I was looking for a solution like this. Thanks dude!
@mike – Thanks for the tip 😀