11

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 Mar 20 at 18:30
  • I'm confused. What does this have to do with bash expansion? Or even bash at all? – Jörg W Mittag Mar 21 at 10:49
13

Recent versions of apt changed the way patterns are specified, and apt no longer supports regular expressions or wildcards.

You should now use

apt install '~nlibkf5.*'

with apt 1.9.9 or later, or the long form

apt install '?name(libkf5.*)'

available slightly earlier.

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

| improve this answer | |
4

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

For the OP's example it will look like

sudo apt-get install "libkf5*"

| improve this answer | |
  • 1
    Thanks N0rbert. Apt-get should be backward-compatible (but not apt ) as stated here, so it should work. – Parsa Mousavi May 28 at 18:20
  • 1
    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*). – Eliah Kagan Jun 16 at 4:26
  • @EliahKagan thanks. – N0rbert Jun 16 at 7:42
1

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.

Incompatibilities

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

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.