Find if a package is installed

3

1

Ubuntu 9.10

I am wondering what apt-cache show emacs.

However, it gives information about emacs but doesn't show if it is currently installed or not.

How can I find if a package and version is currently installed?

Many thanks,

ant2009

Posted 2009-12-09T04:54:14.147

Reputation: 2 595

Answers

4

Use dpkg:

dpkg -s emacs

there is also dpkg-query which allows you to use wildcards in your search:

dpkg-query -l '*emacs*'

John T

Posted 2009-12-09T04:54:14.147

Reputation: 149 037

I did try aptitude show emacs. This is a snippet: "State: not installed" – ant2009 – 2009-12-09T04:58:26.883

didn't know about dpkg-query; i've always just used dpkg -l | grep emacs or similar. – quack quixote – 2009-12-09T05:52:24.917