To find out if a particular package is already installed in Ubuntu, we can use the
dpkg package manager.
dpkg -l package-name
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.
p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.
You can also use
dpkg –get-selectionsto get a list of all the currently installed packages.