Find the package a command belongs to on rpm-based distros

whichpkg() { rpm -qf "$@"; }
Find the package a file belongs to on an rpm-based distro.
Sample Output
~$ whichpkg /bin/sort
coreutils-8.10-2.fc15.x86_64

0
By: flatcap
2011-07-05 23:39:32

5 Alternatives + Submit Alt

What Others Think

on this site you can vote for the most interesting commands. someone has made a habit always to vote in a negative way my commands. I want to make a habit of positive or negative vote and declare it openly. +1 for this command
0disse0 · 363 weeks ago
This is useful on rpm based systems like RedHat/SuSE/CentOS. I wonder if this was voted down by the Debian/Ubuntu folks? The dpkg alternatives don't work on rpm systems. +1 from me for the "rpm -qf" part. I'm not sure you need a function (or alias) for it, but either way it's useful and unfairly voted down.
splante · 337 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: