Sunday, May 5, 2024
65
rated 0 times [  65] [ 0]  / answers: 1 / hits: 252402  / 1 Year ago, thu, april 20, 2023, 9:15:27

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?


More From » command-line

 Answers
3

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.


[#41485] Friday, April 21, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oredoise

Total Points: 66
Total Questions: 116
Total Answers: 111

Location: Lebanon
Member since Sun, Aug 2, 2020
4 Years ago
;