How to list the packages that we have installed in Ubuntu

installed-packages-cover

Have you ever wondered if it is possible to see the packages you have installed? Have you ever wondered if you had a package installed but didn't know how to look at it? Well, in this little tutorial we show you how we can know it in our Ubuntu (and practically in any GNU / Linux distro).

Just executing a command in Terminal, we can list all packages that we have installed. It is a very simple and practically instantaneous procedure. So now you know, when you doubt about the existence of a package in your Ubuntu, follow this mini-tutorial and your doubts will disappear immediately. In addition, it will also serve you in case you are curious to know how many packages do you have installed o how much memory do they occupy. We tell you.

Sometimes we are going to install a package, either a library or an application directly, but suddenly we do not know if we had already installed it previously. In many of these occasions, the quickest thing is to look for the application in question, and if it appears, it is obviously already installed. But of course, if we have to look for a library, or a necessary package for the operation of some other App, it is not so easy to find and know if we have already installed it before.

Well, how we mentioned, we can know this information just executing a command in the terminal. For this we will use the program DPKG-Query, which will be in charge of listing all the packages that we have installed. The command to execute is the following:

 dpkg-query -W -f = '$ {Installed-Size} $ {Package} \ n' | sort -n

Note: The tubing used for the program sort -n It serves us to, in this case, order the packages of smallest to largest size (in kBytes).

This command has an output like the following:

Screenshot from 2016-05-15 16:38:22

But ... what if we want to search only one package to know if it is already installed? Because it is clear that searching for the name of a specific package among all the listed packages is an unthinkable job. Well, obviously there is also a solution, and it is also very simple.

The idea is filter the result using another pipe and the program grep. Thus, of all the packages that have previously appeared, we will be able to filter the result through a keyword, and therefore we will only see listed all those packages that contain said keyword in their name.

Let's take an example. I am interested in knowing if I have Gimp installed. The command to execute is the following:

dpkg-query -W -f = '$ {Installed-Size} $ {Package} \ n' | sort -n | grep gimp

Which generates an output like the following:

Screenshot from 2016-05-15 16:38:32

As you can see, only the packages that contain the word gimp in her name. In addition, we can see that said word is marked in red.

In this way, we have been able to know that we already have Gimp installed, in a simple way and executing just one command. Easy right? We hope that the article has helped you and that you leave your opinion in the comments section.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

     pedrodc said

    Hello everyone I have a problem with Ubuntu server 14.04.4. I have installed it on a 40gb disk and with all the programs and data installed it has become too small for me, I would like someone to help me since I have read through the forums that there is a tool I think is LVM that resizes and joins several disks in one. I would like to increase my disks by 2 500gb, another 320gb and another one more than 1tb, how can I do it, so as not to reinstall everything again since I have been using Ubuntu for a short time. and in windows this is done hot but Ubuntu has more security than windows, and I like it better if someone sent me a tutorial explaining it to me, I would appreciate it thanks in advance (Pedrodc)

     Rayne Sfsj Masakoy said

    synaptic from toa life

     Jesus said

    The command 'sudo dpkg -l' also shows the installed packages, right? Without showing the size that it occupies

     Daniel Montesdeoca Garcia said

    it doesn't work ...

        Rayne Sfsj Masakoy said

      pretty conky 🙂