If you are using Ubuntu or Debian and other Linux distribution that are use dpkg or apt-get commands to install, remove or update packages, you probably have some problems when you don’t remember a package is installed or not on your system. Don’t worry if you don’t remember it, dpkg have a feature to check a package is installed or not.
So in this quick tutorial I will show you How To Check If A Package Is Installed Or Not In Ubuntu, lets get started.
Check a Package is installed or not
To check a particular package is installed or not is simple, just by using this command below :
$ dpkg -s package_name
As you can see on the screenshot above, the leafpad package is installed.
Check a Package with a decent output
You can check a package with dpkg-query, but with dpkg-query will display the output with a decent output. To use this command just type this :
$ dpkg-query -l package_name
If you see the screenshot, the output is simpler than the dpkg -s command above.
List all installed package in your system
You also can list all installed packages in your system by enter the following command :
$ dpkg --get-selections
The output just like on the screenshot above is very long depending to the number of packages you have installed,
Filter package result with grep
To make the above result much simpler, you can use a filter command grep, with grep it will only show the exact package you need. For example if i want to see what wine packages that already installed on my system. So here is the command :
$ dpkg --get-selection | grep wine
Just like what you see on the screenshot, it will only show package that contains “wine” on it.
That is all for my quick tutorial, I hope this tutorial help you to find your installed package on your system. Every comments are very welcome, just leave it on the comment box. Thank you !