It’s always good to keep an inventory of what packages are installed on your Linux server or desktop.
Unfortunately there’s no single command here that does the trick on all Linux systems.
Different Linux distributions require you to type different commands to display installed packages.
Let’s take a deko at commands for a bunch of key distributions.
RedHat, CentOS & Fedora
For RPM based distributions like RedHat and CentOS, run the below command to get a list of installed packages:
$ rpm -qa
Alternatively, you could run:
yum list installed
If you want to save the output to a text file for later reference or printing, issue either of the below commands.
$ rpm -qa > Installed_Packages.txt
$ yum list installed > Installed_Packages.txt
My recommendation is to run the commands frequently (say once a month) and keep a copy of the output with the dates saved in the file.
Debian, Ubuntu & Linux Mint
Since a lot of folks these days are running Linux Mint or Ubuntu on their desktops, let’s see the appropriate command for these Apptitude distributions.
$ dpkg -l
If you want to save the output to a file, run the below command:
$ dpkg -l > Installed_Packages-Jan-5-2015.txt
Arch Linux & Manjaro
While Linux Mint is the clearly the flavor of the season on the desktop side, Arch Linux is not without its fan base, particularly among experienced users.
By the way, Arch Linux and Manjaro are Pacman based distributions.
$ pacman -Q
To retrieve a list of the files installed by a package, here’s what you need to run:
$ pacman -Ql package_name
OpenBSD & FreeBSD
Here’s the command to get the list of packages installed on your FreeBSD system:
Pkg is the package management tool for both FreeBSD and OpenBSD.
$ pkg info
For older versions of FreeBSD (i.e. pre 10.x), use the below command:
If you’re looking for the list of programs (not packages) installed on your system, try:
$ compgen -c
I’ve tested compgen –c on Linux Mint 17.1 and CentOS 7. It worked fine on both.
As always, be sure to check the man pages for each of these distribution for the variety of options.