Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

How can I find out if a specific program is installed? [duplicate]

Writer Emily Wong

I want to find out if a program - Chromium for example - is installed on Ubuntu or not. Manually or as a package.

How do I know if a program is installed via command line?

1

5 Answers

And there's always apt-cache policy <package-name> (no sudo needed).

Not installed:

oli@bert:/$ apt-cache policy gnuift
gnuift: Installed: (none) Candidate: 0.1.14-11 Version table: 0.1.14-11 0 500 oneiric/universe amd64 Packages

Installed:

oli@bert:/$ apt-cache policy firefox
firefox: Installed: 8.0+build1-0ubuntu0.11.10.3 Candidate: 8.0+build1-0ubuntu0.11.10.3 Version table: *** 8.0+build1-0ubuntu0.11.10.3 0 500 oneiric-updates/main amd64 Packages 500 oneiric-security/main amd64 Packages 100 /var/lib/dpkg/status 7.0.1+build1+nobinonly-0ubuntu2 0 500 oneiric/main amd64 Packages

Or dpkg: dpkg -l | grep -E '^ii' | grep <package name>. When it's not installed it won't show output. When it is, it'll show something like:

oli@bert:~$ dpkg -l | grep -E '^ii' | grep firefox
ii firefox 8.0+build1-0ubuntu0.11.10.3 Safe and easy web browser from Mozilla
ii firefox-branding 8.0+build1-0ubuntu0.11.10.3 Safe and easy web browser from Mozilla - transitional package
ii firefox-globalmenu 8.0+build1-0ubuntu0.11.10.3 Unity appmenu integration for Firefox
ii firefox-gnome-support 8.0+build1-0ubuntu0.11.10.3 Safe and easy web browser from Mozilla - GNOME support
ii firefox-locale-en 8.0+build1-0ubuntu0.11.10.3 English language pack for Firefox

It's obviously a fuzzier search but handy if you're not sure which package you're looking for.

For manually installed things...

A bit harder but if they're on the current path, you could just run them. That's a bit of mission so I'd rather just run:

oli@bert:/$ which chromium-browser
/usr/bin/chromium-browser

And:

oli@bert:/$ which gnuift
# returns nothing

Which is better?

That depends on the sanity of user. There's nothing to stop somebody installing something called chromium-browser that isn't Chromium. They could even package it up incorrectly and install that. Neither method can be 100% certain.

But assuming the owner is sane - packages should be good enough for most people.

e,g, Chromium, Run in terminal chromium-browser if it's install, it will be open. If it's not you will get

chromium-browser: command not found 

To check whether a package is install also

dpkg -l | grep chromium-browser

You will get like this if it is installed:

enter image description here

To listing all installed packages, just use

dpkg -l

OR

Use Ubuntu Software Center type chromium

If you see the green icon like this:

enter image description here

That means it is installed :)

1

For a graphical view, open the Software Centre, and click on the Installed button at the top:

enter image description here

You may want to click the Show X technical items button if you're interested in system stuff, but Chromium would be there on the list anyway.

If you want a command line solution, then dpkg is your friend:

$ dpkg -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
ii accountsservic 0.6.14-1git1ub query and manipulate user account informatio
ii acl 2.2.51-3 Access control list utilities
ii acpi-support 0.138 scripts for handling many ACPI events
ii acpid 1:2.0.10-1ubun Advanced Configuration and Power Interface e
ii acroread 9.4.6~enu-0one Adobe Reader
ii acroread-commo 9.4.6~enu-0one Adobe Reader - Common Files
ii adduser 3.112+nmu1ubun add and remove users and groups
ii adium-theme-ub 0.3.1-0ubuntu1 Adium message style for Ubuntu
ii aisleriot 1:3.2.1-0ubunt Solitaire card games
ii alacarte 0.13.2-2ubuntu easy GNOME menu editing tool
ii alsa-base 1.0.24+dfsg-0u ALSA driver configuration files
ii alsa-utils 1.0.24.2-0ubun Utilities for configuring and using ALSA
..........

Well, if you really want anything that is installed, your best bet would be to try to run it. Maybe you can get away with searching for the starter file in all $PATH directories, but if someone installs something in /opt for example, this won't work.

1

You can make use of "dpkg" command. Refer this link

4