When I run this command :

apt install libkf5*

I get the following error :

Unable to locate package libkf5*

I'm sure that the packages whose names start with libkf5 exist (tab-completion says so) . So the problem is not about the absence of those packages.(Note the asterisk at the end of that error message , the wildcard's not working at all)
I use apt v.1.9.
Thanks in advance.

  • 2
    That can be a very dangerous way to locate a package. If you are not careful, you might install something you didn't expect.
    – user535733
    Commented Mar 20, 2020 at 18:30

5 Answers 5


Recent versions of apt changed the way patterns are specified, and apt no longer supports regular expressions directly or wildcards, other than * for which support was restored in 2.1.0 and backported to 2.0.3.

You should now use

apt install '~nlibkf5.*'

with apt between 1.9.9 and 2.0.2, or the long form

apt install '?name(libkf5.*)'

available slightly earlier.

See the apt-patterns manpage (man apt-patterns) for details.

  • as a quick workaround for Ubuntu 20.04 users, apt-get still support the old *name* syntax; also Ubuntu 20.10's apt re-added support for the *name* syntax, meaning it's almost certain that the next LTS will also support it ^^ (for some reason it was just unsupported in specifically 20.04)
    – hanshenrik
    Commented Oct 31, 2020 at 12:32

One can still use plain apt-get for such purpose.

For the OP's example it will look like

sudo apt-get install "libkf5*"

  • 1
    Thanks N0rbert. Apt-get should be backward-compatible (but not apt ) as stated here, so it should work. Commented May 28, 2020 at 18:20
  • 2
    Note that, if one is to do this, one should still quote the pattern so that the shell does not expand it. Otherwise, strange and undesired results will ensue if any file in the current directory is (in the example given here) named starting with libkf5. In place of libkf5*, any of 'libkf5*', "libkf5*", or libkf5\* will prevent the shell from doing its own expansion (and the shell performs quote removal before passing the argument to apt-get, so apt-get will itself see libkf5*). Commented Jun 16, 2020 at 4:26

Per the changelog of apt, version 2.1.0:

* Reinstate * wildcards (Closes: #953531) (LP: #1872200)

(Link: Launchpad #1872200)

The asterisk (and only asterisk) has been restored for all apt subcommands, including apt install.

While 2.1.0 is too new to be shipped to Focal, it's been backported to 2.0.3 which is available in the focal-proposed repository. You can refer to the Ubuntu Wiki for enabling the Proposed repository, and then you can install apt 2.0.3 which has this feature backported.

See for yourself:


Note: You may want to read What is the "proposed" repository? before proceeding with the Proposed repository.


Ubuntu 20.04 introduced Apt 2.0

From the Release Notes:

New Features

  • Commands accepting package names now accept aptitude-style patterns. The syntax of patterns is mostly a subset of aptitude, see apt-patterns(7) for more details.


  • The apt(8) command no longer accepts regular expressions or wildcards as package arguments, use patterns (see New Features).

I found a small trick to use apt with wildcard. We just need to alias apt with apt-get, but this method doesn't work because aliases are not passed to sudo. To pass out this problem, you can add an second alias for sudo in your .bashrc file:

alias sudo='sudo ' # whitespace is important 
alias apt='apt-get'


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .