How to know if a package is installed or not in Linux

Package and magnifying glass

Sometimes we find that we need to know if any program or package is installed in the system or not. The problem is that with the amount of package managers available for the different GNU / Linux distributions, this can be somewhat complicated for newbies as they have to remember the different commands or tools as well as their options in each case so that we show if the package is in our system.

For example, if we move on Arch Linux and derivatives, the tool we are looking for is the package manager pacman with the -Qs options and the name of the package we want to check. On the other hand, if it is a distro based on RPM packages, we can use the rpm -qa tool that lists all the installed packages and pipe the output with the help of a pipe towards grep package-name to filter the result. For Debian and derivatives you can use dpkg -s followed by the name of the package to consult, etc.

You may think that which is a generic solution for any distribution, and the truth is that it would work up to a point, since not all packages are found in the paths where which search and therefore it may seem that if we look for certain software packages it seems that they have not been found and are not installed in the system but they are ... For example, if we look if the nano text editor is installed with which we can see perfectly if It is there or not, but if we test it with LibreOffice the thing varies:

which nano

which libreoffice

The result of both will be very different, since in the first case it will indicate the path of the binary (/ bin / nano) and in the second it will not show us any output even if LibreOffice is installed. That is what I meant. Therefore, in the end we have no choice but to learn the different commands and options for the distro we are using:

Related article:
Solution to boot problems in Ubuntu and Linux Mint

pacman -Qs nombre-paquete

rpm -qa | grep nombre-paquete

dpkg -s nombre-paquete

 


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

A comment, leave yours

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  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.

  1.   Walter Omar Dari said

    Hello, for distributions that use the .deb (Debian and derivatives) you can use ...

    dpkg -l | grep package_name_or_part_of_the_part

    Pay attention to the first column, if "ii" appears it is an installed package, other combinations of letters may appear (man dpkg).

    Another way, but you have to know the exact name of the package, is ...

    dpkg -s package_name

    ... gives quite detailed information about it.

    regards

bool (true)