Clean up your ubuntu box

After running the system for a long time. Today I found few things I should do to clean the box.

First clean the old package files in cache, When you do "sudo aptitude update|upgraed|install", the packages will be downloaded to your local disk[ locate at /var/cache/apt/archives/ ] then installed. If you try ls that directory you will see how many packages you've download. To prevent these cache from growing we should remove some outdated package by

pnix@pnix-a7n:~$ sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
Del compizconfig-settings-manager 0.1.0+git20070717~3v1ubuntu0 [461kB]
Del libcompizconfig-backend-gconf 0.1+git20070709~3v1ubuntu0 [29.5kB]
Del libdecoration0 1:0.5.1+git20070706~3v1ubuntu1 [2401B]

next install localepurge. [These package will remove all locale in your system except what you choose to keep]
pnix@pnix-a7n:~$ sudo aptitude install localepurge

it will open package configuration for select language you want to use on your system. I select all en,de,pt and th.

another thing is orphaned libraries[ the packages that no longer use]. To find orphaned packages we need a tool.
pnix@pnix-a7n:~$ sudo aptitude install deborphan

Now to use it, just type "deborphan" in terminal then orphaned packages will be listed and you can remove it with "aptitude purge <package>".
pnix@pnix-a7n:~$ deborphan
pnix@pnix-a7n:~$ sudo aptitude purge libglut3
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following packages will be REMOVED:
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 49.2kB will be freed.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
(Reading database ... 109118 files and directories currently installed.)
Removing libglut3 ...
localepurge: Disk space freed in /usr/share/locale: 21704K
localepurge: Disk space freed in /usr/share/man: 3168K

Total disk space freed by localepurge: 24872K


or if you want one line command try this.
sudo deborphan | xargs sudo apt-get -y remove --purge


Anonymous said...

Hey it is too cool i just did what you have told and my system has more store space

Kudos!!!!!!!!!!!! to you