Dec 012016

In this brief post, I’ll quickly show you how to check via the terminal if a particular program is installed on an Ubuntu Linux system.

For easy understanding, I will consider a program that is already installed (keepassx) on my computer and one that is not installed nmap.

On the terminal, there are two reliable ways to find out if a program is installed on an Ubuntu or Linux Mint system: Via apt-cache policy or by running dpkg.

apt-cache policy Method

The below output shows the popular open source password manager keepassx is installed.

gestalt@masha ~ $ apt-cache policy keepassx
Installed: 2.0.2-1
Candidate: 2.0.2-1
Version table:
*** 2.0.2-1 500
500 xenial/universe amd64 Packages
100 /var/lib/dpkg/status

Let’s now run the apt-cache policy command with nmap (a program not installed on my system).

gestalt@masha ~ $ apt-cache policy nmap
Installed: (none)
Candidate: 7.01-2ubuntu2
Version table:
7.01-2ubuntu2 500
500 xenial/main amd64 Packages

The above output shows the security scanner program nmap is not installed.

dpkg -l Method

Now let’s consider the dpkg -l method.

gestalt@masha ~ $ dpkg -l | grep keepassx
ii keepassx 2.0.2-1 amd64 Cross Platform Password Manager

Voila, there you have it.

The above output shows that the password manager keepassx is installed on my system.

Let’s run dpkg -l again and look at the not-installed program nmap now.

gestalt@masha ~ $ dpkg -l | grep namp

Since I have not installed nmap on my computer, I did not get any output.

I performed the above tests on a Linux Mint 18 (a derivative of Ubuntu) computer running the Cinnamon desktop 3.0.7 and the 4.4.0-21-generic x86_64 (64 bit) kernel.

Sorry, the comment form is closed at this time.