Ubucleaner – Simple bash script to keep your Ubuntu System Clean

Sponsored Link
Ubucleaner is a simple bash script that help you to keep your computer clean.

Note:- This is Only for advanced Ubuntu users

Ubucleaner Features

-- Clean apt cache
-- Remove config files left from uninstalled .deb packages(it happens if you don't use the --purge switch with apt-get)
-- Remove every kernel except the one you are using
-- Empty the trashes of every user(including root)

It uses apt and the kernel removing thing searches for ubuntu-only packages, so it can't work on non-debian system and the result is undetermined for other debian-based system, but you can still use the other features of the script(you'll just have to comment the parts you don't want).

The script assumes that you are using the text-based Aptitude application, rather than apt-get and dpkg. If you are not using Aptitude, you should also replace the reference to aptitude clean with apt-get clean and the reference to aptitude purge to dpkg --purge.This can be done done by editing the following script.

First you need to download the script from here or using the following command

wget http://www.opendesktop.org/CONTENT/content-files/71529-ubucleaner.sh

Now you should have 71529-ubucleaner.sh file you need to give execute permissions using the following command

sudo chmod +x 71529-ubucleaner.sh

Run the script using the following command


Sponsored Link

You may also like...

21 Responses

  1. likemindead says:

    How much of an impact can Ubucleaner have? On a scale of 1 to 10, how important would you rate it?

    Great site. I always enjoy your posts. Keep up the great work.

  2. Dvergeylen says:


    I’m one of the autors of a similar script, but a little more advanced (but it’s in french).

    See more features on : http://doc.ubuntu-fr.org/maintenir_systeme.
    It’s very easy to use (you have to select the task you want to be done) and it will do it for you. It’s obviously totally under GPL licence so you can re-use the bash script.


    Daniel V.

  3. admin says:


    Really Nice script.Is there anyway you can provide english version of this so that we can write tutorial about that.

    Thanks for your nice script

  4. steven says:

    Yes, I think it is a good work, but it is in France ? Can they change it to English please ?
    then… is this script work for Ubuntu Intrepid Ibex ???
    Please Ubuntugeek.com, if there is similar script like this, can you post the article OK ? good work… well done


  5. F@bio says:


    Great script!

  6. Dvergeylen says:

    Hello Again.

    I’ll contact the other authors to translate the script in English. We’ll probably improve it a bit to allow translations in many other languages (e.g: one file of code and one file of Strings wich can be translated). I think that once the base will be correct, other translations will follow.

    I’ll give you more information on this thread as soon as possible.

    Daniel V.

  7. admin says:


    Thanks for the followup

  8. tuxcayc says:

    Pretty useful, thanks.

  9. Predatorian says:

    if i use apt-get, it would be the same command, just leave the aptitude in the script, or how would i edit that?

  10. I would be happy to translate the script to English if it is moved to Launchpad.

  11. Havilson Peixoto says:

    Hey, since I’ve used ubucleaner I couldn’t load HAL anymore. The only problem is erlated to the ethernet card that is no more operational. It’s a inboard ethernet card, all of the rest (the nvidia driver and compiz for example) are working well, any ideas on how to fix it?

    Thanks and best regards,


  12. yurek says:

    http://doc.ubuntu-fr.org/maintenir_systeme is now available in english ( draft ). Can you test it and send me corrections ?

    step :
    add :
    deb http://scriptsbash.xdir.org/apt/ intrepid universe

    sudo apt-get update

    sudo apt-get install maintenir-systeme

    Applications / System Tools / Maintenir Systeme

  13. Hi Yurek
    I have made some corrections to the english version of the script and the language file is now ready to go. Can I email it to you?
    You can contact me at jonolumb [[((at))]] gmail.com (remove both brackets)



  14. Mason says:

    Just FYI, to execute the script it should be

    sudo ./71529-ubucleaner.sh

    I’m sure everyone can figure that out, but I think it should be changed so the tutorial is accurate.

  15. Rob Kingston says:

    Brilliant! Worked as smoothly as anything. Nothing like a fresh Ubuntu for the New Year.

    Ditto what Mason says.

  16. Danny Tatom says:

    I use apt-get, so edited aptitude purge to dpkg -purge like stated above, and get this when running it:

    Removing old kernels…
    dpkg: need an action option

    Type dpkg –help for help about installing and deinstalling packages [*];
    Use `dselect’ or `aptitude’ for user-friendly package management;
    Type dpkg -Dhelp for a list of dpkg debug flag values;
    Type dpkg –force-help for a list of forcing options;
    Type dpkg-deb –help for help about manipulating *.deb files;
    Type dpkg –license|–licence for copyright licence and lack of warranty (GNU GPL) [*].

    Options marked [*] produce a lot of output – pipe it through `less’ or `more’ !
    Emptying every trashes…
    Script Finished!

  17. fahrur says:


  18. Andrew Z. says:

    You may also like BleachBit which can remove hundreds of MBs from your system. I wrote BleachBit and plan to add features like this script has.

  19. phants says:


  20. Joan says:


    I’m a Bleachbit user and it’s awesome. A great app!!



  21. pi4r0n says:

    Hello ALL

    I would like to raise kind of a bug with this script and would appreciate if the owner of it could have a look at it and fix it 🙂

    Few weeks ago I have manually upgraded to new version of ALSA divers. All was fine (sound in speakers was ok suboffer as well evan my mic was working) until I run this script (71529-ubucleaner.sh) Then I have noticed that mic stop working. The reason for that was that some of the files (mic module – dont know which one) was deleted.

    Could someone have a look at this issue and try to avoid deleting alsa files.

    Kind Regards,


Leave a Reply

Your email address will not be published. Required fields are marked *