Debian

Debian Package Search Beginner to Advanced

Debian 10 has a large repository of packages. Whether it be the fonts, databases, editors, games, or development tools, you will find the required package in this repository. To find a particular package in a large repository, you will need to know the exact package name. Sometimes, the program name is different from the package name. For example, for a program named ‘iostat’ used for disk I/O statistics and CPU reporting, the package is named ‘sysstat.’ So, it is necessary to know about the package name to find it in the repository, instead of just the command name and its function.

Several methods can be used to search for packages in Debian 10 Buster. Powerful and stable tools are available for package filtering to search for the correct package name. Debian 10 offers both command-line and graphical package managers to filter and search for packages. Synaptic is a popular tool used for GUI, but it is not good for all machines, including production servers. So, you will need to use some command-line tools to search for Debian packages.

There are several options available for searching for packages in Debian 10. This article will explore how to search for a package using the aptitude, apt-cache, dpkg, and apt package managers. All commands in this article were implemented in the Debian 10 Buster terminal. Using the utilities discussed in this article, you can search packages and show their description.

Search for Available Packages Using the aptitude Command

The aptitude is an application based on Ncurses front end for apt, runs under the terminal application. This is not already installed in Debian, Ubuntu, and other Linux based distributions. To install aptitude in Debian 10, open the terminal using the application search bar as follows:

Type the following command to install aptitude in Debian 10 Buster:

$ sudo apt install aptitude

Once you have installed this tool on your system, you can search for any available package using the aptitude command in the terminal. To do this, follow the syntax below:

$ aptitude search package-name

For example, if you want to search for all OpenSSH packages, run the command shown below:

You can also search for a package using the aptitude Ncurses user interface. Type ‘aptitude’ in the terminal and the following interface will be displayed in the window.

To search for a package, press ‘/’ and then type the package name into the search bar.

Search for Available Packages Using the apt-cache Command

In Debian 10, you can search for available packages in the Debian repository using the apt-cache command. With the apt-cache command, you can also search the DEB packages installed on your system that are not in the Debian repository. Use the following command to perform the search tasks using the apt-cache command.

$ apt-cache search package-name

Example

$ apt-cache search vim

The above command will display the names of packages with the expression “vim” in the description or name. To search for those packages, have the search expression in the name only. Then, enter the following command:

$ apt-cache search --names-only apache

To view more details about the listed package, use the following command:

$ apt-cache show package-name

Example

$ apt-cache show emacs

The aptitude and apt-cache provide similar information about the packages.

In most cases, the results will be too long. To shorten the results, you can run the following command:

$ apt-cache search package-name | more

You can exclude the results that do not have a specific keyword using the grep command, as follows:

$ apt-cache search package-name | grep package-name2

The grep command is case-sensitive. To ignore the case-sensitivity, use the flag -i (grep -i search-word).

Search for Available Packages Using the apt Command

Using the apt command, you can search for all available packages. Use the following syntax to do a search using apt:

$ apt search package-name

Example

$ apt search emacs

Search Available Packages Using the dpkg Command

To search for installed packages, use the dpkg command, as follows:

$ dpkg -S search-pattern

Example

$ dpkg -S apache

You can also use dpkg with grep, as follows:

Conclusion

This article explored how to search packages using the command-line in Debian 10, including some different methods for searching and filtering. Using these methods, you can search for Debian packages, even if you do not know about the exact package name. You can learn more about the apt-cache, grep search, aptitude, and apt commands on the Internet.

About the author

Karim Buzdar

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.