Debian Package Search

“Installing packages on your Debian system is easy. You could have installed a batch of dependencies or other packages when installing a given tool. The problem comes when you want to locate a given package but can remember all the packages that you’ve installed. Still, it could be you know the keywords associated with a given package, but you don’t know the exact way to locate the package.”

We understand if you are looking for a quick way of searching deb packages and others installed with a snap. Furthermore, you probably want to get information about a package that is not installed or the list of all installed packages. In that case, this guide arms you with various tools and tips to enhance your package search on Debian systems.

Listing Installed Packages

  1. Using dpkg

Debian packages can be queried using the dpkg tool, which lists the details or queries all the installed Debian packages.

To list all the installed Debian packages, use the command below.

$ dpkg-query -l | less

 

The above commands also print the details of the installed packages, including their version and architecture. A better way is to filter the results of the packages and match those of a given keyword using the grep command. For instance, we can use the command below if we are looking for the gcc package.

$ dpkg-query -l | grep gcc

 

If the package is installed, it should get returned. Otherwise, it will give an error.

In the above, the output returned is of any package that matches the keyword “gcc.”

Alternatively, you can use the command below if you want to find a package matching the exact name provided. Here, we will try to find the gcc command as we did earlier.

$ dpkg -l gcc

 

The output below shows how the result only matched the exact package name.

Still, you can display any results matching a given keyword using the -S flag, as in the case below.

$  dpkg -S gcc

 

  1. Using apt

Most packages get installed and managed using the apt or apt-get command. Still, you can use apt to view all the installed packages or find specific packages by filtering the results. Take a look.

To view all the installed packages on your system, use the command below.

$ apt list --installed

 

We can narrow down the search results by using grep to match specific keywords of the package you are searching for. Let’s consider the git package. The command to search for it using apt would be as follows.

$ apt list --installed | grep git

 

The above output clearly outlines that the gcc package is installed on the system. You can also note the architecture and versions of the specified package.

  1. Using apt-cache

Any official package, whether installed or not, can be found using the apt-cache option. The command queries the Debian list of all packages, and you can use it to find a package based on keyword match and even get the details about the given package.

If unsure of the name of the package, use the command below. Here, you will query all packages whose name or description matches the keyword added. In this case, it’s vlc

$ apt-cache search vlc

 

To narrow the output to only display packages that match the search expression, use the –names-only flag.

$ apt-cache search --names-only vlc

 

Still, you can get the information about the given package using the show flag.

$ apt-cache show vlc

 

All the details of the specified package will get listed in the image above. You can use the command to query the details of any package.

  1. Using snap

If you want to search for a given package that is not Debian-related, such as the snap packages, you can search them using the snap command shown below.

$ snap list

 

You can combine with grep to get a filtered result.

$ snap list | grep package-name

 

Conclusion

With the above methods, you can easily search for packages on your Debian system. Use any methods described above based on the target package and what you intend to obtain with the search.



from https://ift.tt/UQ0NxoL

Post a Comment

0 Comments