You are not logged in.

#1 2011-08-17 12:44:50

ytj
Member
Registered: 2010-11-14
Posts: 24

[SOLVED]How to find which package a specific cmd or file belongs to?

For example, I want to know which package that owns "convert", I can do this:

$ pacman -Qo convert
/usr/bin/convert is owned by imagemagick 6.7.1.6-1

However, what if I didn't install imagemagick package?

In Ubuntu, if a command doesn't exist, system will tell you what package do you need.
Is there any way to do it in Arch?


Further more, can we find a package according to a file? Cite a case:

$ pacman -Qo /lib/cpp
/lib/cpp is owned by gcc 4.6.1-2

It could be better if it works with AUR.

Last edited by ytj (2011-08-17 12:49:17)

Offline

#2 2011-08-17 12:47:16

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

Re: [SOLVED]How to find which package a specific cmd or file belongs to?

Try "pkgfile" from the "pkgtools" package. It does not work with AUR packages, however.


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

Offline

#3 2011-08-17 12:48:00

jaco
Member
From: Toulouse, France
Registered: 2011-03-17
Posts: 149

Re: [SOLVED]How to find which package a specific cmd or file belongs to?

pkgfile, in the pkgtools package :

% pkgfile convert
extra/imagemagick

% pkgfile /lib/cpp
local/gcc-multilib

Offline

#4 2011-08-17 12:48:49

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,543

Re: [SOLVED]How to find which package a specific cmd or file belongs to?

too slow

Last edited by skunktrader (2011-08-17 12:49:37)

Offline

#5 2011-08-17 12:51:46

ytj
Member
Registered: 2010-11-14
Posts: 24

Re: [SOLVED]How to find which package a specific cmd or file belongs to?

Thanks to all for this quick replies.

Offline

#6 2011-08-17 15:24:47

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED]How to find which package a specific cmd or file belongs to?

ytj wrote:

In Ubuntu, if a command doesn't exist, system will tell you what package do you need.
Is there any way to do it in Arch?

# pkgfile includes a "command not found" hook for both zsh and bash.
# This will automatically run pkgfile whenever you run a command
# which the shell cannot find. Set CMD_SEARCH_ENABLED to 1 to
# enable this feature, or 0 to disable.
#
# Caveats
# Bash: requires bash >= 4.0
CMD_SEARCH_ENABLED=1
[karol@black ~]$ bsdiff

bsdiff may be found in the following packages:
community/bsdiff (4.3-6) : /usr/bin/bsdiff

Offline

Board footer

Powered by FluxBB