Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the best tool that, for any given package, attain the following, if possible, information:

  • What is the package used for?
  • When was it installed?
  • Was this package installed manually or was it required by another package?
  • Are there any packages currently installed that depends on this package, i.e. will something break if it is removed?
share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

This is a great question. You would think that there would be one nice, handy-dandy tool to tell you such things, but I don't know it. I'll go one by one, and give my best suggestions.

  1. What is the package used for?
  2. When was it installed?
  3. Was this package installed manually or was it required by another package?
  4. Are there any packages currently installed that depends on this package, i.e. will something break if it is removed?
  1. On the command line, aptitude show package or apt-cache show package will provide a description of the package, as well as a lot of other information. Synaptic allows you to search for an item in various ways, and it provides a description of the package. (The descriptions you get from all these methods are identical. They all get their information from the same place in a .deb, I believe.)

  2. Such a simple thing, but other than digging through logs, I can't think of how to do this. Synaptic doesn't seem to keep this information as meta-data. (This would make a great wish-list bug.) Here's one way to do it:

    zgrep package /var/log/dpkg*
    

    That's a bit cludgy, and it will produce a lot of output, but it should also get you the date you want. (You need zgrep since older logs will be gunzipped archives.) By the way, you need to be root even to search dpkg's logs.

  3. If you run aptitude show package on an installed package, check the field "Automatically installed." If it says yes, it was brought in as a dependency of some other package. (For the record, there are things you can do to manually change this setting. That is, you can mark a package to look manually installed, even though it was actually installed as a dependency. But for the most part, the results here should be valid.) You can also filter Synaptic searches to look for things installed as dependencies.

  4. A brute-force way to check this:

    aptitude -s remove package
    

    The -s flag simulates commands. You can run such a command as a regular user, and there's no danger of actually harming your system. It allows you to see easily what the proposed action would do. One thing to keep in mind is that this sort of check will show you gross breakage, but it won't show broader mistakes. What I mean is you might be able to remove package Foo without truly breaking your system, but it may severely limit the usefulness of package Bar. In general, packages are chained together through recommendations to prevent just this, but it's worth keeping in mind. You can also search for dependencies and reverse dependencies using apt-cache, but I find the simulated run is the most vivid way of seeing what will happen.

One other general search tip for Aptitude. On the command line, you can use these searches to quickly see what you have installed by choice versus what was installed automatically as a dependency of something else:

aptitude search '~i !~M' # Find things not installed as something else's dependency
aptitude search '~i ~M'  # Find things installed as something else's dependency
share|improve this answer
    
Great answer! Thank you... while it looks like its possible to get all the information I want, I would prefer to have a gui, like Synaptic, but built for survey rather than install/remove/upgrade. The very core of the question is a way to answer "Do I really need this package?", as I aim to clean up the OS on this box a bit. –  mizipzor Aug 2 '09 at 13:05
add comment

The Debian User Manual has a section on APT which describes the commands to search / query and interrogate the currently installed and repository packages.

For example the command below will show detailed information regarding a specific installed application.

apt-cache showpkg package
share|improve this answer
add comment

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.