How do I check if a package is installed on my server?

I recently installed Ubuntu Server edition 13.10 (Saucy Salamander). But I have run into a bit of problem.

At the end of the installation, it asks about several extra packages whether you want them or not, like OpenSSH server and virtual machine host. Here's what I'm looking at:

dialog offering packages

Now, my problem is that I can't remember if I have checked the "virtual machine host" checkbox. How do I check if my server has the corresponding packages?

What packages come with the virtual machine host?


Solution 1:

Are you looking to know about all dpkg commands with options? Have a read from the below link.

15 dpkg commands to Manage Debian based Linux Servers

To List all Installed Packages

Here less is a simple text reader used to scroll through the list of packages in a new buffer that opens in the existing terminal window. The list will not be mixed with other terminal commands and output. Hit q to return to the terminal prompt. See man less for more info.

dpkg -l | less

To check whether a package is installed or not:

dpkg -l {package_name}
dpkg -l vlc

To check if the package is installed or not (for example, vlc). If installed, launch the package:

dpkg -l | grep vlc

Show the location where the package is installed. The -S (capital S) stands for "search"

sudo dpkg -S {package_name}
sudo dpkg -S skype

To use Grep to search:

dpkg -l | grep {keywords}
dpkg -l | grep pdf

Solution 2:

apt -qq list PACKAGE can also be used for checking whether the PACKAGE is installed.

If installed it'll print something like (with [installed] at the end of the line):

$ apt -qq list awscli
awscli/stable,now 1.4.2-1 all [installed]

If not installed the output will be:

$ apt -qq list awscli
awscli/stable 1.4.2-1 all