To determine if a package is installed on a Ubuntu Linux system, you can use the command
dpkg -s packagename
where packagename
is the name of the package.$ dpkg -s python-software-properties Package: python-software-properties Status: install ok installed Priority: optional Section: python Installed-Size: 196 Maintainer: Michael Vogt <michael.vogt@ubuntu.com> Architecture: all Source: software-properties Version: 0.82.7.5 Depends: python2.7, python (>= 2.7.1-0ubuntu2), python (<< 2.8), python-apt (>= 0.6.20ubuntu16), lsb-release, python-gnupginterface, unattended-upgrades, iso-codes, python-pycurl Description: manage the repositories that you install software from This software provides an abstraction of the used apt repositories. It allows you to easily manage your distribution and independent software vendor software sources.
If a package isn't installed, you will see output similar to the following:
$ dpkg -s linssid Package `linssid' is not installed and no info is available. Use dpkg --info (= dpkg-deb --info) to examine archive files, and dpkg --contents (= dpkg-deb --contents) to list their contents.
You can use the dpkg-query -l
command with the wild card
character, *
, to see a list of packages that match a specified
pattern. E.g., to see all packages that begin with python-py
:
$ dpkg-query -l 'python-py*' 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 +++-==============-==============-============================================ un python-pyatspi <none> (no description available) ii python-pyatspi 2.4.0+dfsg-0ub Assistive Technology Service Provider Interf ii python-pycurl 7.19.0-4ubuntu Python bindings to libcurl un python-pycurl- <none> (no description available) un python-pygment <none> (no description available) un python-pyicu <none> (no description available) ii python-pyinoti 0.9.2-1 simple Linux inotify Python bindings un python-pyinoti <none> (no description available) un python-pylons <none> (no description available)
An asterisk, "*", can represent one or more characters. You can also use a question mark, "?", to represent just one instance of any character. E.g.:
$ dpkg-query -l 'xin*' 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 xinit 1.3.1-1 X server initialisation tool ii xinput 1.5.99.1-0ubun Runtime configuration and test of XInput dev jim@lancelot:~/Documents/blog$ dpkg-query -l 'xin??' 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 xinit 1.3.1-1 X server initialisation tool
To get a list of all packages on the system, use dpkg-query -l
.