1

I love the Macports and Arch package managers, because I can generate a listing of all of the packages that I have manually installed, and "prune" the package tree every once in a while to keep my distribution lean. I would like to know how I can do this using apt-get and yum.

For example, with Macports, I can type port echo requested and get a nice listing of all of the packages that I have explicitly installed. If I see a package I installed a few weeks ago that I no longer need, I can immediately uninstall it. To get rid of unused dependencies, I can repeatedly execute port uninstall leaves. Analogous commands are available using pacman.

It is not clear to me how I can achieve similar functionality using apt-get and yum after reading the relevant man pages and doing a fair amount of Googling. One of the most important functions of a good package manager should be to let the administrator easily manage the list of explicitly installed packages. Certainly I am missing something.

Thanks for your help!

1

2 Answers 2

6

To show packages that were manually installed, use apt-mark showmanual. To show packages that were automatically installed, use apt-mark showauto.

Also, apt-get has autoremove. From the man page

autoremove

autoremove is used to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed.

So use apt-get autoremove for this.

Generally apt will prompt you if packages are available to be autoremoved, so I would expect a user to become aware of this command quite quickly.

Additionally, there are packages like debfoster and deborphan to help users to reduce package clutter.

Also wajig has several commands that can be used to prune packages, including, but not limited to large, and sizes, which can be used to look at the large packages installed on the system.

Also, it is worth mentioning the apt log files in /var/log/apt, notably history.log, which keep a log of the installations and removals performed by apt.

2
  • How can I list the packages that I have explicitly installed? My question isn't about how I can clean unused dependencies; it's about how I can remove packages that I explicitly installed earlier but no longer need. Oct 1, 2013 at 8:23
  • 1
    @void-pointer apt-mark showmanual ` Oct 1, 2013 at 8:31
2

yum has many ways:

yum autoremove
yumdb search reason user (this will include things done via. the installer though).
yum history
yum list distro-extras
yum list extras
package-cleanup --leaves (see man page for options).

...the main difference to understand is that with Mac ports the software you are using is just controlling a tiny subset of packages, whereas with yum/apt you'll be dealing with the entire system.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .