To find out if a particular package is already installed in Ubuntu, we can use the dpkg
package manager.
dpkg -l package-name
Change package-name
to the name of your package. For example, if you want to check if the nano
editor is installed.
dpkg -l nano
If the package nano
is installed, the result should be:
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 Architecture Description
+++-==========================-==================-==================-============================================
ii nano 2.5.3-2ubuntu1 amd64 small, friendly text editor inspired by Pico
If the package is not installed, the result will be:
dpkg-query: no packages found matching nano
Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.
You can also use
dpkg –get-selections
to get a list of all the currently installed packages.