Ask Your Question

dnf search for file in repositories

asked 2017-09-08 17:55:07 -0500

alfC gravatar image

Is it possible to use dnf or some other tool to search for particular file in the repositories.

For example I am looking for any devel package that has a file named spblas.h. In particular I am looking for some source file declaring or implementing a function called csrmm, but I understand looking for file contents may not be possible, so I am asking about searching by file name.

$ dnf search ... ??

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-09-09 02:48:00 -0500

For command:

dnf provides */foobar

for library, file and etc.:

dnf provides /path/to/foo/
edit flag offensive delete link more



There is no difference between those two, except that one of them provides a glob. You can use glob for any file search, for example

dnf provides '*/foo/'

Notice the glob should be in quotes as you would not want the shell to expand the glob. For command you could search using

dnf provides '*/*bin/foobar'

excluding all files not in a bin directory.

villykruse gravatar imagevillykruse ( 2017-09-09 04:01:01 -0500 )edit

Sure, those are similar, I expanded them to give example.meanwhile simple globs like */foobar works correctly in bash,(doesn't work in zsh). But I'm agree with you, generally using quotes is better.

haghighi gravatar imagehaghighi ( 2017-09-09 11:25:45 -0500 )edit

Why wouldn't it work in zsh, assuming you are quoting the glob. If you don't quote the glob and bash find a match, then the glob would be expanded before passing it to the dnf command.

villykruse gravatar imagevillykruse ( 2017-09-09 11:45:31 -0500 )edit

No, let me clarify with an example, go to an empty directory, with Bash and Zsh, and type dnf provides */ls. there is nothing to expand, so command executed correctly in Bash, but in ZSH you need to quote the glob. This situation also exist for other commands.

haghighi gravatar imagehaghighi ( 2017-09-09 11:59:33 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-09-08 17:55:07 -0500

Seen: 1,005 times

Last updated: Sep 09 '17