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:
- Using the aptitude command
- Using the apt-file command
- Using the dlocate command
- Using the dpkg command
- Using the apt command
- Using the apt-cache command
- Using the snap command
- 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
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
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
After installing the apt-file command, first, update its cache:
$ sudo apt-file update
Now use the apt-file for searching the vim text editor:
$ sudo apt-file search vim
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
Now use the “L” option of the dlocate command to search the vim package:
$ sudo dlocate -L vim
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
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
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
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
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:
The package of vim has been displayed on the screen:
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:
- Using the apt Package Manager
- 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
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
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
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
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.