Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: * no longer a wild card in apt?

  1. #1
    Join Date
    Apr 2008
    Beans
    11,707

    * no longer a wild card in apt?

    I haven't found any documentation for this but it used to be you could use * as a wild card to search packages, or maybe I had a bad dream

    Anyway, if I'm right about the past, has that changed? Is there a replacement? I have looked at the apt man pages but sometimes something can be right in front of my nose and I don't see it.

  2. #2
    Join Date
    Mar 2011
    Beans
    1,994

    Re: * no longer a wild card in apt?

    Well, apt-cache pkgnames never took wild cards, i pipe its output to grep. Other apt-cache commands like show do. so depends upon what you are doing.

  3. #3
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    8,430
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: * no longer a wild card in apt?

    AFAIK, the apt command has never taken the * character as a wildcard. The older apt-get does, though, so you might be thinking of that.

  4. #4
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    5,263
    Distro
    Ubuntu

    Re: * no longer a wild card in apt?

    Are you perhaps remembering dpkg and dpkg-query? They allow wildcards. Remember to quote the query string. For example:
    Code:
    dpkg-query --list 'libc6*'
    Always make regular backups of your data (and test them).
    Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.

  5. #5
    Join Date
    Apr 2008
    Beans
    11,707

    Re: * no longer a wild card in apt?

    So being more specific here's one example. Let's say I wanted to search all packages (both installed and just available) that begin with "linux-generic". If I know the full package name I can:

    Code:
    lance@lance-desktop:~$ apt policy linux-generic
    linux-generic:
      Installed: 5.4.0.62.65
      Candidate: 5.4.0.62.65
      Version table:
     *** 5.4.0.62.65 500
            500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
            500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
            100 /var/lib/dpkg/status
         5.4.0.26.32 500
            500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
    lance@lance-desktop:~$ apt policy linux-generic-hwe-20.04
    linux-generic-hwe-20.04:
      Installed: (none)
      Candidate: 5.8.0.38.43~20.04.23
      Version table:
         5.8.0.38.43~20.04.23 500
            500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
            500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
         5.4.0.26.32 500
            500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
    ]
    But is there a way to get a search for all packages beginning with "linux-generic" to display? Like there is actually also a 'linux-generic-hwe-18.04':

    Code:
    lance@lance-desktop:~$ apt policy linux-generic-hwe-18.04
    linux-generic-hwe-18.04:
      Installed: (none)
      Candidate: 5.4.0.62.65
      Version table:
         5.4.0.62.65 500
            500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
            500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
         5.4.0.26.32 500
            500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
    Another example would be searching all 'nvidia' packages. Like I might know that my puter uses 'nvidia-340' but I also may have no idea what version of nvidia drivers I have installed. Is there a way to see from TTY what nvidia packages are installed in one fell swoop? Things like this can be very helpful if the UI is broken and you suspect kernel issues or graphics issues and you can only get into the system via TTY, possibly even in a chroot.

    A third example might be examining 'grub' although in that case you could use Boot Repair to produce a report and likely find what you needed to know or at least enough to point you in the right direction.

    If it's at all possible to get a working UI with the addition of a specific boot parameter my preferred method is just using Synaptic package manger - the lazy man's way out (just my speed)

  6. #6
    Join Date
    Jan 2006
    Location
    Sunny Southend-on-Sea
    Beans
    8,430
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: * no longer a wild card in apt?

    Quote Originally Posted by kansasnoob View Post
    But is there a way to get a search for all packages beginning with "linux-generic" to display? Like there is actually also a 'linux-generic-hwe-18.04'
    I would use
    Code:
    aptitude search linux-generic
    which will return a list of matching packages and their installed status, followed by
    Code:
    aptitude show <package name>
    if I wanted to know something particular about the versions that are installed or available.

  7. #7
    Join Date
    Aug 2016
    Location
    Wandering
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: * no longer a wild card in apt?

    I love aptitude, just have to be cautious mixing with "Apt" installations, not a thing wrong using it for searches though.
    With realization of one's own potential and self-confidence in one's ability, one can build a better world.
    Dalai Lama>>
    Code Tags | System-info | Forum Guide lines | Arch Linux, Debian Unstable, FreeBSD

  8. #8
    Join Date
    Apr 2008
    Beans
    11,707

    Re: * no longer a wild card in apt?

    Quote Originally Posted by Paddy Landau View Post
    Are you perhaps remembering dpkg and dpkg-query? They allow wildcards. Remember to quote the query string. For example:
    Code:
    dpkg-query --list 'libc6*'
    Reading the dpkg man pages led me to using this:

    dpkg --list | grep <partial-package-name>, eg:

    Code:
    lance@lance-desktop:~$ ls /boot
    config-5.4.0-62-generic      memtest86+.elf
    config-5.4.0-64-generic      memtest86+_multiboot.bin
    grub                         System.map-5.4.0-62-generic
    initrd.img                   System.map-5.4.0-64-generic
    initrd.img-5.4.0-62-generic  vmlinuz
    initrd.img-5.4.0-64-generic  vmlinuz-5.4.0-62-generic
    initrd.img.old               vmlinuz-5.4.0-64-generic
    memtest86+.bin               vmlinuz.old
    lance@lance-desktop:~$ dpkg --list | grep 5.4.0-62
    ii  linux-headers-5.4.0-62                     5.4.0-62.70                         all          Header files related to Linux kernel version 5.4.0
    ii  linux-headers-5.4.0-62-generic             5.4.0-62.70                         amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
    ii  linux-image-5.4.0-62-generic               5.4.0-62.70                         amd64        Signed kernel image generic
    ii  linux-modules-5.4.0-62-generic             5.4.0-62.70                         amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
    ii  linux-modules-extra-5.4.0-62-generic       5.4.0-62.70                         amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
    It's not a one-size-fits-all approach but dpkg does get the job done if you're willing to study the man pages, and it does so without the need of installing additional packages.

  9. #9
    Join Date
    May 2008
    Location
    United Kingdom
    Beans
    5,263
    Distro
    Ubuntu

    Re: * no longer a wild card in apt?

    Quote Originally Posted by kansasnoob View Post
    It's not a one-size-fits-all approach but dpkg does get the job done if you're willing to study the man pages, and it does so without the need of installing additional packages.
    No extra packages required. dpkg-query is installed by default.

    Your query doesn't need grep, though: The following two commands will do the same thing.
    Code:
    dpkg --list '*5.4.0-62*'
    dpkg-query --list '*5.4.0-62*'
    The advantage of dpkg-query over dpkg is that it's explicitly a query, so you avoid accidentally making a change. But you don't need to use it.
    Always make regular backups of your data (and test them).
    Visit Full Circle Magazine for beginners and seasoned Linux enthusiasts.

  10. #10
    Join Date
    Apr 2008
    Beans
    11,707

    Re: * no longer a wild card in apt?

    Quote Originally Posted by Paddy Landau View Post
    No extra packages required. dpkg-query is installed by default.

    Your query doesn't need grep, though: The following two commands will do the same thing.
    Code:
    dpkg --list '*5.4.0-62*'
    dpkg-query --list '*5.4.0-62*'
    The advantage of dpkg-query over dpkg is that it's explicitly a query, so you avoid accidentally making a change. But you don't need to use it.
    Sweet! That brings the wildcard into play as I'd inquired about. Also shows available (uninstalled) packages as well.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •