How to Search for Debian Packages in Linux

Debian’s official repository comes with hundreds of packages that can be installed on the computer. These packages include text packages, games, and web browsers which provide ease to its users in performing their tasks. 

To search for the software packages on Debian, different command-line methods and GUI methods can be used. This search saves the time of Debian’s users and they can download the packages from other sources if not found in the default repository of Debian. 

What are the Methods to Search Debian Packages in Linux?

There are different commands that can be used to search the packages on Debian:

  1. Using the aptitude command
  2. Using the apt-file command
  3. Using the dlocate command
  4. Using the dpkg command
  5. Using the apt command
  6. Using the apt-cache command
  7. Using the snap command
  8. Using the GUI Method

Method 1: Search Debian Packages Using the aptitude Command

The first method of finding the Debian packages is by using the aptitude command. This package manager can be used with the execution of the command:

$ sudo apt install aptitude -y
Search for Debian Packages in Linux 1

To search Debian’s package with the aptitude command, use the “search” option. For example, search for the “vim” text editor with the command:

$ sudo aptitude search vim
Search for Debian Packages in Linux 2
Search for Debian Packages in Linux 3

It shows the Vim text editor and also other libraries which contain the “vim” keyword.

Method 2: Search Debian Packages Using the apt-file Command

Another method of finding Debian’s package is by using the apt-file command. To use the apt-file command utility, first, install it:

$ sudo apt install apt-file -y
Search for Debian Packages in Linux 4

After installing the apt-file command, first, update its cache:

$ sudo apt-file update
Search for Debian Packages in Linux 4

Now use the apt-file for searching the vim text editor:

$ sudo apt-file search vim
Search for Debian Packages in Linux 6

Method 3: Search Debian Packages Using the dlocate Command

The following method to search the packages on Debian is by using the dlocate command. Install the dlocate command using the apt package manager:

$ sudo apt install dlocate -y
Search for Debian Packages in Linux 7

Now use the “L” option of the dlocate command to search the vim package:

$ sudo dlocate -L vim
Search for Debian Packages in Linux 8

It will locate the packages which are only installed.

Method 4: Search Debian Packages Using the dpkg Command

The dpkg manager can also be used to search Debian’s packages with its “S” option. For example, search for the “vim” package using the dpkg command:

$ sudo dpkg -S vim
Search for Debian Packages in Linux 9

Method 5: Search Debian Packages Using the apt Command

The apt package manager can also be used to search for Debian’s packages by using its “search” option:

$ sudo apt search vim
Search for Debian Packages in Linux 10
Search for Debian Packages in Linux 11

Method 6: Search Debian Packages Using the apt-cache Command

The apt-cache command can also be used to search the packages. To search the “vim” package using the apt-cache command:

$ sudo apt-cache search vim
Search for Debian Packages in Linux 12
Search for Debian Packages in Linux 13

Method 7: Search Debian Packages Using the snap Command

The snaps downloaded from the Snapcraft store can be installed on Debian. To search the installed snaps, list them:

$ sudo snap list
Search for Debian Packages in Linux 14

Method 8: Search Debian Packages Using the GUI

The Graphical User Interface is the easiest method to search for the Debian packages. Open the GNOME Software Store and search for the “vim” package:

Search for Debian Packages in Linux 16

The package of vim has been displayed on the screen:

Search for Debian Packages in Linux 17

These are the eight methods by which the packages can be searched on Debian.

How to Search for the Installed Packages on Debian?

To search for the installed packages on Debian, two popular known approaches can be used:

  1. Using the apt Package Manager
  2. Using the dpkg Package Manager

Method 1: Search Installed Debian Packages Using the apt Package Manager

First method of searching the installed Debian Packages is by using the apt package manager. Run the below-mentioned command to display the installed packages on Debian:

$ sudo apt list --installed
Search for Debian Packages in Linux 18

All the installed packages are displayed on the screen. To find the particular installed package on Debian, for example, to find the “installed vim package” run the command:

$ sudo apt list --installed | grep vim
Search for Debian Packages in Linux 19

The package has been installed on Debian. 

Method 2: Search Installed Debian Packages Using the dpkg Package Manager

Another known method for searching the Debian’s installed packages is by executing the below-mentioned command of dpkg:

$ sudo dpkg-query -l
Search for Debian Packages in Linux 20

It will display the complete list of installed packages on Debian. To count the number of installed packages, use the command:

$ sudo dpkg-query -f '${binary:Package}\n' -W | wc -l
Search for Debian Packages in Linux 21

Conclusion

To search for Debian’s packages, use any of the commands from apt, apt-file, apt-cache, aptitude, dpkg, dlocate, and snap. The GNOME software store can also be used to search and install the packages on Debian. In this blog, all the mentioned methods for searching the packages have been explained with the example. 

Over 500 Million Views on Our Blogs and YouTube! We’re inviting 10 businesses to partner with us and grow together. Click here to join us! ×