I'm exploring working with the ubuntu terminal. For particular reason I need to check if I have installed Python interpreter, like cPython. How to do it? In general, how to check if some program is already installed and its version?
Asked
Active
Viewed 2.0k times
1
3 Answers
4
You can get a list of all installed packages with
dpkg --get-selections
to get more info about a package try
dpkg -s <PACKAGENAME>

Ruediger
- 2,182
4
You can try these.
By which
which <packagename>
Example: which firefox
Correct Result: /usr/bin/firefox
By dpkg
dpkg -l | grep <packagename>
Example: dpkg -l | grep firefox
Correct Result: ii firefox 22.0+build2-0ubuntu0.12.04.2 Safe and easy web browser from Mozilla
Illustration
2
To know the version of an installed package just use the dpkg-query
command:
$ dpkg-query -W foo
dpkg-query: no packages found matching foo
$ dpkg-query -W unity
unity 7.2.0+14.04.20140423-0ubuntu1.2

Sylvain Pineau
- 62,169
-
@PeterMortensen Indeed, only the version string can tell if the package is installed or not, good point. Thanks – Sylvain Pineau Jul 19 '16 at 16:29
sudo apt-get install <package>
? – Tim Jul 17 '14 at 18:53