Blog Archives

#Linux : list all packages installed

Sometimes we want to quickly check if we have a required package installed, for example a developer library we need to compile our code.

If you are running a Debian based Linux system such as Ubuntu, you have a couple of alternatives. Using apt, let’s say we are looking for python3-dev since it is required to debug python code through gdb:

#sudo apt list --installed | grep python3-dev

However, you will notice apt is pretty slow and we will be greeted by the warning WARNING: apt does not have a stable CLI interface. Use with caution in scripts.. Moreover, the output is not so nice if we want to parse it in a scripted way. A faster alternative is provided by dpkg:

#sudo dpkg -l | grep python3-dev

In RedHat and RedHat-like Linuxes such as Fedora and CentOS we can use either rpm:

#sudo rpm -qa | grep python3-dev

or yum:

#sudo yum list installed | grep python3-dev

Advertisement
%d bloggers like this: