A quick script to list all installed packages

I wanted a list of all the installed packages on my Xubuntu system. The easiest choice was to start the Ubuntu Software Center and click on the “Installed” tab. But, that requires at least one mouse/touchpad click and that is painful for me! So, I wanted a command-line option. Naturally, I googled for it but came up with no quick-to-use, ready-made solutions. So, I read glanced through the Ubuntu Community AptGet Howto and put together a quick, tiny script that is now publicly available as yet another GitHub Gist.

You will have to download the gist which will arrive in “tar.gz” format. So, you untar-gz it (tar fxvz <gist-name>.tar.gz). You will find the script itself under “<gist-name>/” directory after the untar-gz finishes. So, once you have the script, copy it to a convenient location like say “/usr/local/bin“. Assuming you haven’t renamed the script file itself, you should now see the file as “/usr/local/bin/listInstalledPackages.sh“. So, “chmod 555 /usr/local/bin/listInstalledPackages.sh” and you are good to go.

Assuming “/usr/local/bin” is in your PATH, here are some simple ways to use the script:

$ listInstalledPackages.sh | less

That will generate a paginated list of all the packages installed on your system.

$ listInstalledPackages.sh | wc -l

That will generate a total count of how many packages are installed on your system.

$ listInstalledPackages.sh | grep -i bluetooth | less

That will generate a paginated list of installed packages that have the string “bluetooth” in them. You can obviously use any other single word in place of bluetooth to find packages with that specific string.

$ listInstalledPackages.sh | grep -i pidgin | less # list all installed packages with pidgin in them
$ listInstalledPackages.sh | grep -i zenity | less #list all installed packages with zenity in them
$ listInstalledPackages.sh | grep -i ibus | less #list all installed packages with ibus in them

So, that’s that! 😀

This script should work on most Debian based systems like:

  • Debian itself
  • Ubuntu, Lubuntu, Xubuntu, Kubuntu
  • Linux Mint
  • Bodhi Linux
  • CrunchBang Linux
  • Kali Linux
  • etc.

If you want to know how this simple script works, read the comments at the bottom of the script file.

HTH!

Advertisements