Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I recently installed java6 on my debian box. I went to use javac and noticed it wasn't installed. Eventually I figured out (after searching online) that javac is part of the java6-sdk package. This isn't the first time where I've know the command I want, but I don't know the package(s) it's in.

My question is- is there a way to on the command line to figure out what file belongs to what package(s)? So if I wanted to see what packages javac belonged to, it would list java6-sdk, java5-sdk, .. since they all contain javac.

share|improve this question
    
all great comments! Thanks everyone! –  user7321 Jul 8 '09 at 20:06

4 Answers 4

up vote 2 down vote accepted

apt-file is the command you're looking for.

share|improve this answer

You can use apt-file search filename for that. You could just go to Debian Packages and search the online version.

share|improve this answer

I know this isn't exactly what your looking for, but:

dpkg -L packagename

will list all of the files belonging to an installed package. (but you want this for uninstalled packages)

I don't know how it does this, but Ubuntu (derived from Debian) will suggest a package as follows:

$ chkrootkit
The program 'chkrootkit' is currently not installed.  You can install it by typing:
sudo apt-get install chkrootkit
bash: chkrootkit: command not found

And I have often done the obvious, and typed the name of the file, along with "Debian" into google to find the package.

share|improve this answer
2  
The package is called "command-not-found - Suggest installation of packages in interactive bash sessions" and it's available in Debian as well, but installed by default on Ubuntu. –  LiraNuna Jul 8 '09 at 18:03
    
Thanks! I've always wondered!! –  Brent Jul 8 '09 at 18:39

you might also want to look at the dlocate package. it has many useful options for listing packages and files within packages. it was originally written to be a much faster version of dpkg -L, dpkg -S etc but has gained many useful features over the years (while still retaining the speed :)

DISCLAIMER: I'm the author and debian maintainer of dlocate.

BTW, install the version of dlocate from testing or unstable. it has numerous improvements over the version in stable (in particular, it doesn't depend on GNU locate any more) and still works fine in stable (doesn't depend on any new/updated libs etc).

share|improve this answer

Your Answer

 
discard

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.