You are not logged in.

#1 2019-09-17 00:09:10

rado84
Banned
From: Sofia, Bulgaria
Registered: 2019-05-12
Posts: 135

Pacman - command to display only exact match to the search terms?

Atm when I use pacman (or trizen, for that matter) to search for packages, it shows all packages containing the word. For instance, I search for Wine and I get tons of results containing the word "wine" in the package names, including one called "twine".
So, I wonder is there any command to tell pacman/trizen to show only exact matches of the searched package? Meaning, that if I wanna find "wine", it would show me only "wine" and nothing else?


Core i7-4770, GTX 1660 Ti, 32 GB RAM, Arch 6.x LTS, Cinnamon 5.2.7, GDM

Offline

#2 2019-09-17 00:35:50

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Pacman - command to display only exact match to the search terms?

man pacman wrote:

When you include multiple search terms, only packages with descriptions matching ALL of those terms will be returned.

┌─[Shiv ~]
└─╼ pacman -Ss  firefox browser                                                                                                                               
extra/firefox 69.0-1 [installed]
    Standalone web browser from mozilla.org
community/browserpass-firefox 3.1.1-1
    Firefox extension for Browserpass, browser extension for zx2c4's pass (password manager)
community/firefox-developer-edition 70.0b5-1
    Developer Edition of the popular Firefox web browser
community/firefox-extension-privacybadger 2019.7.1.1-1 (firefox-addons)
    Block third party tracking in your browser
community/firefox-ublock-origin 1.22.2-1 (firefox-addons)
    Efficient blocker add-on for various browsers. Fast, potent, and lean
┌─[Shiv ~]
└─╼ pacman -Ss  firefox standalone browser                                                                                                                    
extra/firefox 69.0-1 [installed]
    Standalone web browser from mozilla.org

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2019-09-17 01:24:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: Pacman - command to display only exact match to the search terms?

Why would you want to use a search flag if you know the exact name of the package, you already know the name!

Do you want information about that package?  Then use `pacman -Si wine`.
Do you want to install that package?  Then use `pacman -S wine`.
Do you want to know if that package is installed?  Then use `pacman -Q wine`.

What exactly is it that you think you might come to know about the wine package by using `pacman -Ss wine`?

Note that pacman search can have some regex syntax, e.g., `pacman -Ss ^wine$` would return only a package exactly matching wine, but again, what on earth would be the point of that command?

Last edited by Trilby (2019-09-17 01:26:44)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2019-09-17 09:13:13

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 1,932
Website

Re: Pacman - command to display only exact match to the search terms?

I think the regex matching is broken, since pacman does not value the EOL character correctly:

$ pacman -Ss wine
community/twine 1.14.0-1
    Collection of utilities for interacting with PyPI
community/vkd3d 1.1-1
    Direct3D 12 to Vulkan translation library By WineHQ
community/wine-mono 4.9.2-1
    Wine's built-in replacement for Microsoft's .NET Framework
community/winetricks 20190912-1
    Script to install various redistributable runtime libraries in Wine.
multilib/lib32-vkd3d 1.1-2
    Direct3D 12 to Vulkan translation library By WineHQ
multilib/wine 4.15-1
    A compatibility layer for running Windows programs
multilib/wine-nine 0.4-1
    Gallium Nine Standalone
multilib/wine-staging 4.15-1
    A compatibility layer for running Windows programs - Staging branch
multilib/wine_gecko 2.47-2
    Wine's built-in replacement for Microsoft's Internet Explorer
$ pacman -Ss ^wine$
multilib/wine 4.15-1
    A compatibility layer for running Windows programs
multilib/wine-staging 4.15-1
    A compatibility layer for running Windows programs - Staging branch

Last edited by schard (2019-09-17 09:13:26)

Offline

#5 2019-09-17 10:28:15

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Pacman - command to display only exact match to the search terms?

wine-staging provides wine.

allan@kamala ~ 
> pacman -Sqs gcc | wc -l
20

allan@kamala ~ 
> pacman -Sqs gcc$ | wc -l
12

Offline

#6 2019-09-17 10:29:10

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,784
Website

Re: Pacman - command to display only exact match to the search terms?

That's because -Ss also searches provides (and wine-staging provides "wine", which matches the regex).


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#7 2019-09-17 10:54:17

xerxes_
Member
Registered: 2018-04-29
Posts: 662

Re: Pacman - command to display only exact match to the search terms?

Why would you want to use a search flag if you know the exact name of the package, you already know the name!

what on earth would be the point of that command?

Maybe because 'pacman -Q wine' is slow when someone have many packages installed and old, slow hard drive.
Or maybe he want limit output of match. Try for example 'pacman -Ss file'.

Last edited by xerxes_ (2019-09-17 11:01:37)

Offline

#8 2019-09-17 11:16:01

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Pacman - command to display only exact match to the search terms?

xerxes_ wrote:

Maybe because 'pacman -Q wine' is slow when someone have many packages installed and old, slow hard drive.

Yet, running "pacman -Ss" reads every file pacman -Q does...

Offline

#9 2019-09-17 11:25:34

rado84
Banned
From: Sofia, Bulgaria
Registered: 2019-05-12
Posts: 135

Re: Pacman - command to display only exact match to the search terms?

Trilby wrote:

Why would you want to use a search flag if you know the exact name of the package, you already know the name!

Do you want information about that package?  Then use `pacman -Si wine`.
Do you want to install that package?  Then use `pacman -S wine`.
Do you want to know if that package is installed?  Then use `pacman -Q wine`.

What exactly is it that you think you might come to know about the wine package by using `pacman -Ss wine`?

Note that pacman search can have some regex syntax, e.g., `pacman -Ss ^wine$` would return only a package exactly matching wine, but again, what on earth would be the point of that command?

pacman -Ss wine shows a huge list of packages that contain these characters in their names and I was hoping that after eliminating the unnecessary packages from the list, I'll be able to make it show the results in this manner: [package name] [installed version] [available version in the repo].


Core i7-4770, GTX 1660 Ti, 32 GB RAM, Arch 6.x LTS, Cinnamon 5.2.7, GDM

Offline

#10 2019-09-17 11:50:34

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: Pacman - command to display only exact match to the search terms?

xerxes_ wrote:

Or maybe he want limit output of match.

I got that - but to what end?  For what purpose?  Limiting output to packages that start with "wine" may make sense, and that's precisely what a regex could do.  But why would one search for a package when they already know the exact name of it?

xerxes_ wrote:

Maybe because 'pacman -Q wine' is slow when someone have many packages installed and old, slow hard drive.

And in every such case, `pacman -Ss wine` would be far slower; orders of magnitude slower in my case.

rado84 wrote:

I'll be able to make it show the results in this manner: [package name] [installed version] [available version in the repo].

Even pacman -Ss doesn't show that format*.  But that still really doesn't answer the question, what purpose would this serve?

*note: pacman does not show the different version numbers, and more importantly, even if it did, it wouldn't show the installed version and repo version, it would show the installed version and sync database version ... and if these ever differ, you should stop doing partial upgrades.

Last edited by Trilby (2019-09-17 11:55:39)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#11 2019-09-17 11:56:41

rado84
Banned
From: Sofia, Bulgaria
Registered: 2019-05-12
Posts: 135

Re: Pacman - command to display only exact match to the search terms?

I just wanna know when the new version of wine (or other packages I use) has finally arrived in the repo. I saw an article from about a day ago saying Wine 4.16 is released but when I run the update command, it says both installed and available versions are the same. So apparently I'm missing something, I just don't know what it is.


Core i7-4770, GTX 1660 Ti, 32 GB RAM, Arch 6.x LTS, Cinnamon 5.2.7, GDM

Offline

#12 2019-09-17 12:00:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: Pacman - command to display only exact match to the search terms?

Ah, so it is a complete XY question.

Pacman -Ss could not give you a different version than pacman -S.  If the version you are (re)installing doesn't match what is actually in the repos then you either need to update your db or update your mirrorlist.  But again, there is no output of `pacman -Ss ...` that could serve any useful purpose here.

In this case, however, 4.16 was just released and is not in the repos yet, so your question is just #6.

I also have a sense that you are doing partial upgrades.  There is no need to explicitly list package names to upgrade them.  If you got output noting that the current version was being reinstalled, you must have added 'wine' to the pacman command line.  There is no need for this.  Upgrade properly and regularly with `pacman -Syu` and you will get the new wine package as soon as it is ready.

Last edited by Trilby (2019-09-17 12:04:41)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#13 2019-09-17 15:14:14

xerxes_
Member
Registered: 2018-04-29
Posts: 662

Re: Pacman - command to display only exact match to the search terms?

'checkupdates' command show if there are some packages to update and from what version to what; than you can do 'pacman -Syu'.

Also you can check site https://www.archlinux.org/packages/?sort=-last_update

Last edited by xerxes_ (2019-09-17 15:17:08)

Offline

#14 2022-07-03 18:24:38

ei
Member
Registered: 2020-07-16
Posts: 7

Re: Pacman - command to display only exact match to the search terms?

Trilby wrote:

Why would you want to use a search flag if you know the exact name of the package, you already know the name!

Do you want information about that package?  Then use `pacman -Si wine`.
Do you want to install that package?  Then use `pacman -S wine`.
Do you want to know if that package is installed?  Then use `pacman -Q wine`.

What exactly is it that you think you might come to know about the wine package by using `pacman -Ss wine`?

Note that pacman search can have some regex syntax, e.g., `pacman -Ss ^wine$` would return only a package exactly matching wine, but again, what on earth would be the point of that command?

-Qi shows too much information. I just want the information shown by -Qs, and I only want it for precise matches, and I don't want to use grep or anything to filter the results of -Qi. I'm writing a script and just ran into a use case of this today; that's how I ended up on this thread.

Offline

#15 2022-07-03 18:57:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: Pacman - command to display only exact match to the search terms?

ei wrote:

-Qi shows too much information.

This is one of several reasons why I never suggested -Qi or -Qs.  But given that this is a three year old thread and your use case is completely different than the OPs, you should open your own thread and not necrobump.

Last edited by Trilby (2022-07-03 18:59:04)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#16 2022-07-03 19:17:00

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,420

Re: Pacman - command to display only exact match to the search terms?

Closing this old topic.

Offline

Board footer

Powered by FluxBB