Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

5 Answers

up vote 21 down vote accepted

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 http://archive.ubuntu.com/ubuntu/ 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 http://archive.ubuntu.com/ubuntu/ oneiric-updates/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu/ oneiric-security/main amd64 Packages
        100 /var/lib/dpkg/status
     7.0.1+build1+nobinonly-0ubuntu2 0
        500 http://archive.ubuntu.com/ubuntu/ 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.

share|improve this answer
add comment

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 :)

share|improve this answer
    
thanks for the command it is very useful –  Naruto Dec 13 '11 at 14:49
    
@Naruto You're welcome :) –  Achu Dec 13 '11 at 14:53
    
nice answer helpful. but here when i hit dpkg -l to check all package installed, it listed all but i was unable to see list till 1st program. Do you knw how can i see it till 1st program –  Rakesh Ostwal Jul 19 '13 at 11:17
add comment

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
..........
share|improve this answer
add comment

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.

share|improve this answer
    
hahaha and what if i want to make a script to install a program that depends on another so i want to check if it is installed first then install the main program that i want –  Naruto Dec 13 '11 at 14:44
add comment

You can make use of "dpkg" command. Refer this link http://ssatish.wordpress.com/2012/12/31/ubuntu-how-to-check-if-a-software-is-installed/

share|improve this answer
3  
Can you please add some detail to this answer? It may be helpful but you risk having it deleted as it's not much more than a link to another site. –  Tom Brossman Dec 31 '12 at 8:53
    
Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  hhlp Dec 31 '12 at 13:52
    
no need to downvote the answer just because it's not complete. If it's wrong then, sure downvote away. –  Thufir Sep 14 '13 at 4:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.