Surely more than once you have needed to find out what package you have installed on your computer, but it becomes a tedious task to open the package manager and after certain steps you can check which packages you have on your computer.
There is a much less tedious and much faster way to perform this task, it is from the terminal and it is also easy to do, do not worry, here I tell you how it is.
We open the terminal and you are going to use these lines of code, according to the distro you use, and you will see if a package is installed on your computer or not.
- Arch Linux: pacman -Ss package
- Fedora: yumsearch package
- Debian / Ubuntu: apt-cache search package
- OpenSUSE: zypper se package
- Gentoo: emerge -S package
But not everything ends there, because if what you need is to know if you have a special program installed then you must use any of these lines of code, as in the previous case, you must use the code according to the distro you use.
- Arch Linux: pacman -Qs package
- Fedora: rpm -qa | grep package
- Debian / Ubuntu: dpkg -l | grep package
- OpenSUSE: zypper se -i package
- Gentoo: emerge -pv package
This is a simple way to check what package and / or program we have in our team, and thus save effort and time searching in the package manager, I hope it helps you.
As far as I remember the "apt-cache search" serves to validate if that package exists in your repositories, with the possibility of being able to install it if you don't already have it installed, but it does not only show installed packages.
Who knows, maybe I'm the wrong one.
Regards!!
here goes another one for debian
aptitude search package
although you have to install aptitude first
package = package_name; if which $ package &> / dev / null; then echo "yes"; else echo "no"; fi
something more global that works for any "linux"
On Debian, the correct thing to do is:
apt-cache search package: List from the AVAILABLE packages database the packages that match the "package" criteria. It does not mean that they are installed. It is related to the repositories enabled in /etc/apt/sources.list
dpkg -l package *: List the packages that start with the word "package" and their installation status or not on the system. If only the word "package" is used, the match is exact.
Know which packages are installed from Terminal: dpkg –get-selections
List of installed packages with dates: cat /var/log/dpkg.log
Try apt list –installed. Debian and derivatives. You're welcome.