APT Search – How to Search for Only Installed Packages

aptaptitudedebianUbuntu

Using aptitude I can make a search like:

aptitude search '~i bash'

This seems to be an aptitude specific regex. Is it possible to do the same thing using apt or apt-cache without additional commands?

apt search '~i bash'

is not working.

Best Answer

You can try:

apt list --installed bash

This will try to list the installed packages with the name bash

However, if you wanted to search for a particular file, use apt-file

The following command will list all the packages that have string bash within their name:

apt list -a --installed bash

As suggested by @Exostor apt list -a --installed bash is not always the case to list those packages that start with a particular string, instead use:

apt list -a --installed bash*

If globbing is what you're searching for, please upvote @Exostor comment below.

Related Question