Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I wonder to know if should I use ubucleaner script on Ubuntu Oneiric/Precise?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Short answer is: No, it's a bad idea.

Let's look at the code:

#!/bin/bash

OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}')
CURKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')
LINUXPKG="linux-(image|headers|ubuntu-modules|restricted-modules)"
METALINUXPKG="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
OLDKERNELS=$(dpkg -l|awk '{print $2}'|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v $CURKERNEL)
YELLOW="\033[1;33m"
RED="\033[0;31m"
ENDCOLOR="\033[0m"

if [ $USER != root ]; then
  echo -e $RED"Error: must be root"
  echo -e $YELLOW"Exiting..."$ENDCOLOR
  exit 0
fi

echo -e $YELLOW"Cleaning apt cache..."$ENDCOLOR
aptitude clean

echo -e $YELLOW"Removing old config files..."$ENDCOLOR
sudo aptitude purge $OLDCONF

echo -e $YELLOW"Removing old kernels..."$ENDCOLOR
sudo aptitude purge $OLDKERNELS

echo -e $YELLOW"Emptying every trashes..."$ENDCOLOR
rm -rf /home/*/.local/share/Trash/*/** &> /dev/null
rm -rf /root/.local/share/Trash/*/** &> /dev/null

echo -e $YELLOW"Script Finished!"$ENDCOLOR

This script basically consists of 3 calls of a package management tool and it empties the trash folders of each user. Honestly what's the gain here? Freeing up some megabytes or gigabytes, that's all. If you're aiming for a performance gain you're mistaken. If your hard drive is the bottleneck of your current Ubuntu setup, I recommend buying a SSD. It's better to spend that money than spending valuable time trying to clean after something that always will get messy shortly after cleaning up.

I know CCleaner is very popular on Windows due to the habit of Windows users trying to clean up the system because they keep believing that this will increase/restore the system performance. This is partially true because some application developers do a pretty poor job at integrating their applications into Windows, best examples are vendor customized pre-installed versions of Windows and installer packages extracting themselves several times before installation and not cleaning up afterwards (I look at you LENOVO!).

Regarding privacy concerns Ubuntu started shipping an application in the default installation and I hope it will continue to improve that functionality, it looks promising.

However package management as in Ubuntu and most major Linux distributions solves most of the afore mentioned problems. Using the script for system administration is a bad idea. Instead you should be knowing what the script does and remember the commands to execute them individually when needed.

Cleaning APT cache

If I recall correctly, the graphical update manager already takes care of this, so use the update manager instead of aptitude clean if you can.

Removing old config files

Those files don't take up a lot of space and in some cases you would be happy to find an application already configured upon reinstall. If the opposite is the case you can always reconfigure the package via dpkg.

Removing old kernels

Old kernels can take up 200 megabytes and more each. It has been discussed several times how to safely integrate this feature into the update manager. There are blueprints out there, but they don't seem to be implemented until know, mostly because it's difficult to decide which kernel to keep and which not. Deleting all but the newest is considered not to be a good idea.

Emptying trash

In a proper setup this shouldn't be an issue, because home folders should be placed on another file system than the root file system. Then again you as a system administrator can't just go there and empty users trash folders. This is bad management style and may break the work flow of the users. This issue is usually solved via quotas. In turn when you empty users trash folders you should be cleaning up their .thumbnails folders and other folders, too. Welcome to system administration hell. Nope, set a quota if you have to manage users and you're done.

share|improve this answer
    
I find your answer very useful, thanks –  raulricardo21 Aug 7 '12 at 5:44

Personally, Im not sure, I haven’t use it since 10.04. This doesn’t answer your question directly, but have you looked at Ubuntu Tweak? It has the same capabilities as Ubucleaner and a lot more besides.

You can install it by running these commands in the Terminal (Ctrl+Alt+T):

sudo add-apt-repository ppa:tualatrix/ppa 
sudo apt-get update
sudo apt-get install ubuntu-tweak

Before installing this or other software from PPA's, please read this:

However, ppa:tualatrix/ppa is quite well known, as Ubuntu Tweak is very popular software.

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.