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.

  • 3
    No, aptitude-specific search features have not been implemented in apt.
    – jordanm
    Aug 25, 2016 at 15:14
  • Are there some other function in apt giving the same result?
    – Exostor
    Aug 25, 2016 at 15:26
  • 4
    dpkg -l|grep bash Aug 25, 2016 at 15:33
  • dpkg is another command
    – Exostor
    Aug 31, 2016 at 8:06
  • The user interface of Debian package management is exemplary.
    – Rolf
    Jan 29, 2018 at 2:45

3 Answers 3


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.

  • 4
    Ah! but that will not do it, because it will not list bash-builtins, bash-doc etc.. But apt list --installed bash* is close enough for me.
    – Exostor
    Aug 31, 2016 at 12:24
  • Instead of globbing, -a could be used to list all matching packages
    – VanagaS
    Sep 6, 2016 at 6:26
  • 3
    Doesn't work for me. Ubuntu 16.04-machine: apt list -a --installed bash lists bash/xenial-updates and bash/xenial but apt list --installed bash* lists bash, bash-completion and bash-doc, which is the three bash-packages installed on the machine.
    – Exostor
    Sep 14, 2016 at 14:14
  • @Exostor what does -a actually do?
    – ysth
    Aug 20, 2018 at 21:48
  • @ysth Lists all versions of the package. Without -a it only lists the latest release.
    – Exostor
    Sep 12, 2018 at 12:05

dpkg-query --list | grep '^.i\s*PKG'


dpkg-query --list PKG\* | grep '^.i'

where PKG is the desired package name / a reg-ex.


If anybody else is wondering how to go about doing this, I use the following method.

apt list --installed | grep [XYZ]

This method also shows different packages that are installed containing the string you were searching for. For example, if I'm searching for vlc, I'm shown many other packages which also have 'vlc' in their name. Here's input and output:

apt list --installed | grep vlc

WARNING: apt.divert does not have a stable CLI interface. Use with caution in scripts.

browser-plugin-vlc/stable,now 2.0.6-4 amd64 [installed]
libvlc-bin/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
libvlc5/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
libvlccore8/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
phonon4qt5-backend-vlc/stable,now 0.9.0-2 amd64 [installed,automatic]
vlc/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
vlc-bin/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
vlc-data/stable,stable,stable,stable,now 2.2.7-1~deb9u1 all [installed]
vlc-l10n/stable,stable,stable,stable,now 2.2.7-1~deb9u1 all [installed]
vlc-plugin-base/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
vlc-plugin-notify/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
vlc-plugin-qt/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
vlc-plugin-samba/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
vlc-plugin-skins2/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
vlc-plugin-video-output/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
vlc-plugin-video-splitter/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]
vlc-plugin-visualization/stable,stable,now 2.2.7-1~deb9u1 amd64 [installed]

If it turns out you don't have the package installed, the command will simply exit.

  • Out of everything above this is the only thing that worked for me on Mint 18.3
    – JoeManiaci
    Sep 5, 2019 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.