How to search for installed .deb and dpkg packages in Linux !

Debian packages or .deb files are the default package format in Ubuntu Linux and other Debian related distro’s. Many times we need to find the correct package installed also we might need to search for a particular installed package in some directory then the below given tutorial comes very handy.

dpkg is a command line tool that you use to install, build, remove and manage Debian packages. dpkg maintains some usable information about available packages. You can search for a filename from installed packages using dpkg -S command. For example, find out package name for /bin/ls, enter:
$ dpkg -S /bin/ls
Sample output:

coreutils: /bin/ls

You can also obtain detailed status information about coreutils package, enter:

$ dpkg -s coreutils

You can also use dpkg-query command which is a tool to show information about packages listed in the dpkg database. The -l option search for a filename from installed packages. All standard shell wildcards can be used in the pattern. This command will not list extra files created by maintainer scripts, nor will it list alternatives.

# dpkg-query -l 'google-chrome'

The output is as follows:-

apt-file Command

You need to install apt-file command which is a command line tool for searching files in packages for the APT package management system:

# apt-get install apt-file
# apt-file update

To search in which package a file is included, enter:

$ apt-file search date

This is a quickie on how install, uninstall, and search for applications/packages in Ubuntu Linux from the Terminal window.

apt-cache search firefox

firefox being the full or partial name of the package/application for the mozilla firefox browser.

That’s it for now.

Njoy !