Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm answering a question with a suggestion to use rename, and I realize I don't know what package it comes from (as part of the answer, I imagine saying something like "if you don't have rename, it's installed as part of [package]").

man rename tells me to SEE ALSO: mv(1), perl(1) - so my first thought is that it was installed with perl.

A related answer, how to tell what was installed as part of a package, helps me figure out that the perl package includes prename but not rename - and it turns out that my /usr/bin/rename points to /etc/alternatives/rename which points to /usr/bin/prename

So this is still kind of confusing. Did /etc/alternatives/rename point somewhere else before I installed perl? Is there a general way to tell which package something comes from?

share|improve this question
Of course, all these answers only relate to software installed as part of a (proper) package - if it was compiled from source or is actually made up of scripts installed by a custom installer you're stuck. – Chris H Jan 22 '14 at 9:46
Possible duplicate of How do I find the package that provides a file? – muru Jun 6 at 9:58
up vote 13 down vote accepted

install apt-file

$ sudo apt-get install apt-file

update apt-file

$ sudo apt-file update

search the package a file belongs to

$ apt-file search filename

find path of executable

$ whereis rename
rename: /usr/bin/rename.ul /usr/bin/rename /usr/bin/X11/rename.ul /usr/bin/X11/rename     /usr/share/man/man1/rename.1.gz /usr/share/man/man2/rename.2.gz

search package

$ apt-file search /usr/bin/rename
ladr4-apps: /usr/bin/renamer
util-linux: /usr/bin/rename.ul

the package name is: util-linux

share|improve this answer

You can try apt-file (it's not part of default installation).

0) Update apt-file database

sudo apt-file update

1) Find binary

$ which rename

2) Find the package

$ apt-file search /usr/bin/rename
util-linux: /usr/bin/rename.ul

And voila -- rename is part of util-linux

share|improve this answer
sorry, I didn't see your answer. – phipsalabim Feb 18 '13 at 20:28
no problem, you need to type quicker :) – Vojtech Trefny Feb 18 '13 at 20:31

Turns out dpkg-query is good to get information about installed packages, and with the -S [pattern] option will search for packages with files corresponding to [pattern].

dpkg-query -S [filename-search-pattern]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.