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.1k times
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,202
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
- 63,229