You are not logged in.

#1 2010-02-09 10:48:54

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

[SOLVED] How to find which package holds a file?

I noticed on my system a program which I didn't install explicitly (BTW, it is palimpsest). I couldn't find to which package it belongs: how can I do it?
Thanks

Last edited by snack (2010-02-09 10:56:28)

Offline

#2 2010-02-09 10:52:14

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

Re: [SOLVED] How to find which package holds a file?

pkgfile from the pkgtools package.

Offline

#3 2010-02-09 10:55:57

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

Re: [SOLVED] How to find which package holds a file?

Great! I didn't know pkgfile, it's awesome.
Thank you, Allan!

Offline

#4 2010-02-09 12:50:29

Vi0L0
Member
From: Poland
Registered: 2009-06-24
Posts: 1,349
Website

Re: [SOLVED] How to find which package holds a file?

or...
pacman -Qo file
;P

Offline

#5 2010-02-09 13:24:49

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

Re: [SOLVED] How to find which package holds a file?

Vi0L0 wrote:

or...
pacman -Qo file
;P

Right. My fault, I serched in the man page but didn' find it. Thank you, Vi0l0

Offline

#6 2010-02-09 13:27:38

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [SOLVED] How to find which package holds a file?

Vi0L0 wrote:

or...
pacman -Qo file
;P

Not quite. pacman -Qo works only for files already installed. And you need to know their proper path (either relative or absolute).

pkgfile on the other hand looks up in its own packages database. So it works independently of the file being present. You need to keep the database current, of course, using pkgfile -u as root user.

Usage examples:

bp:~$ pacman -Qo /usr/bin/pkgfile
/usr/bin/pkgfile is owned by pkgtools 17-1
bp:~$ pacman -Qo pkgfile
error: failed to read file 'pkgfile': No such file or directory
bp:~$ pkgfile pkgfile
community/pkgtools

bp:~$ which evince
which: no evince in (/home/bp/bin:/bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/opt/java/bin:/opt/java/jre/bin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core:/opt/qt/bin:/home/bp/neo)
bp:~$ PM -Qo evince
error: failed to read file 'evince': No such file or directory
bp:~$ PM -Qo /usr/bin/evince
error: failed to read file '/usr/bin/evince': No such file or directory
bp:~$ pkgfile evince
extra/evince

To know or not to know ...
... the questions remain forever.

Offline

#7 2014-10-11 07:41:30

hashken
Member
Registered: 2014-08-05
Posts: 14

Re: [SOLVED] How to find which package holds a file?

Atleast in the latest version of pacman, you don't need to specify proper path to find a file.

$ pacman -Qo which
/usr/bin/which is owned by which 2.20-7

Offline

#8 2014-10-11 08:00:56

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [SOLVED] How to find which package holds a file?

@ hashken, that's only for the files present in the $PATH. Any other files, you'll need to specify the full path.

Edit: Damnit, didn't notice the thread date.

Last edited by x33a (2014-10-11 08:01:56)

Offline

#9 2014-10-11 08:10:02

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

Re: [SOLVED] How to find which package holds a file?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB