Sometimes it seems like packages get messy, so here are a few ways I have found to keep your system clean.
First, we are going to remove residual config packages. Go to System –> Administration –> Synaptic Package Manager. On the bottom left corner of this window, there are four buttons, one of which says “Status.” Click it, and on the left column there should be a list of items such as Installed, Installed (local or obsolete), Not Installed, Not Installed (residual config). That last one is the one we want. Click on it, and it will bring up a few packages in the package selector part of the window. Right click on these packages and select “Mark for Complete Removal.” You can also click on one of them and hit Ctrl + A to select them all, then right click once instead of doing them all individually. When you’re done hit “Apply” at the top of the screen, and it will remove all those unnecessary packages from your system.
Second, install localepurge. This works automatically whenever you install any packages. To get it, type in a terminal:
sudo apt-get install localepurge
Third is just one command that you should enter periodically:
sudo apt-get autoclean
Fourth is a way to remove orphaned packages. These are packages that aren’t used by any other programs on your computer. I believe the extra repositories must be enabled for this to work. If you don’t already have them enabled click here for edgy or here for dapper.
Now that you have that done you need to install deborphan:
sudo apt-get install deborphan
Once that’s done you can now enter the following command into the terminal periodically to remove all orphaned packages automatically:
sudo deborphan | xargs sudo apt-get -y remove --purge
I find it is helpful to put these commands (sudo deborphan | xargs sudo apt-get -y remove –purge && sudo apt-get autoclean) into a sticky note on my desktop so that I can use them easily all the time.
November 8, 2006 at 9:44 am
Fails on Ubuntu 6.0.6:
$ sudo apt-get install deborphan
Reading package lists… Done
Building dependency tree… Done
Package deborphan is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package deborphan has no installation candidate
November 8, 2006 at 3:08 pm
That worked, thanks.
root@OceanBlue9:/etc/apt# apt-get install deborphan
Reading package lists… Done
Building dependency tree… Done
The following extra packages will be installed:
dialog
Recommended packages:
apt
The following NEW packages will be installed
deborphan dialog
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 264kB of archives.
After unpacking 1585kB of additional disk space will be used.
Do you want to continue [Y/n]?
WARNING: The following packages cannot be authenticated!
dialog deborphan
Install these packages without verification [y/N]? y
Get: 1 http://archive.ubuntu.com dapper/universe dialog 1.0-20060101-1 [201kB]
Get: 2 http://archive.ubuntu.com dapper/universe deborphan 1.7.18 [62.0kB]
Fetched 264kB in 1s (202kB/s)
Selecting previously deselected package dialog.
(Reading database … 101121 files and directories currently installed.)
Unpacking dialog (from …/dialog_1.0-20060101-1_i386.deb) …
Selecting previously deselected package deborphan.
Unpacking deborphan (from …/deborphan_1.7.18_i386.deb) …
Setting up dialog (1.0-20060101-1) …
Setting up deborphan (1.7.18) …
localepurge: Disk space freed in /usr/share/locale: 244K
July 30, 2007 at 3:59 pm
The command below sisnt work for me in gutsy:
sudo deborphan | xargs sudo apt-get -y remove –purge
Worked using:
sudo deborphan | xargs sudo apt-get -y remove
Had to run it 3 or 5 times because of dependencies.
November 4, 2007 at 10:37 am
Thanks! That helped a bit. What I found works like a charm without having to change any file permissions, potentially endangering your system is to use ’sudo’ (love it!) like so:
sudo apt-get autoclean
sudo apt-get clean
Autoclean will delete the var/cache files of programs that aren’t installed.
Clean will delete ALL the var/cache files of programs stored on disk. This helped me free 600 megs!
The first time I tried to do this I messed with my file permissions and delete stuff that I should have NOT deleted, ending up with a fresh install. When I found out that I didn’t need to mess with my file permissions at all by using these two commands above, I was overjoyed! I have since cleaned up my downloaded files cache (’var/cache’) regularly. I must add that you can use this command at your own risk although I have found no problems whatsoever. Enjoy!
April 28, 2008 at 8:29 pm
should be –purge and not -purge
May 23, 2008 at 11:27 am
ncie one
February 4, 2009 at 2:00 am
Worked beautifully for me. Thanks for the article!
February 4, 2009 at 2:00 am
I should also mention, I’m running Ubuntu 8.10 (Intrepid-Ibex).