55

I used UbuntuĀ 14.04 (Trusty Tahr) for about a year (actually upgraded it from UbuntuĀ 12.04 (Precise Pangolin)), and during the time I installed some packages, and removed some other packages.

Now I think it's probably time to clean up the system as it's likely several unused stuff is lying out there (both from the old 12.04 and the new 14.04), and I hope to have a cleaner system that works faster.

I found these two links:

Both links seem good, but when I came across to what they said about Bleachbit then one says yes, and one says no - a bit contradicting.

What should be done for this common task?

tdao
  • 1,025

8 Answers8

49

To remove any packages that aren't needed by the system:

sudo apt-get autoremove

The other answer for this question:

sudo apt-get clean

This just clears the package cache for downloading new packages, it will not uninstall any packages.

See: https://help.ubuntu.com/community/AptGet/Howto

Thom Wilhelm
  • 606
  • 5
  • 3
18

Ubuntu tweak will be to your liking.

It has a "janitor" option where you can clear caches files, delete old kernels, delete orphaned .debs and more like that. But what gets removed tends to be a few MBs of software that is not longer used on your system but will not have interfered with what you normally do.

A crash of kate should be treated as such: search the crash online and see of there is a fix, otherwise you can opt to file a bug report against kate.

Fabby
  • 35,017
Rinzwind
  • 309,379
17

To get rid of partial packages - sudo apt-get autoclean

Get rid of unnecessary locale data - localepurge

Get rid of "orphaned" packages - sudo deborphan | xargs sudo apt-get -y remove --purge

You can refer this article for more detailed information

http://www.ubuntugeek.com/cleaning-up-a-ubuntu-gnulinux-system-updated-with-ubuntu-14-10-and-more-tools-added.html.

Prashant Chikhalkar
  • 2,451
  • 2
  • 19
  • 25
16

On Linux there usually is no need to clean your system, even after multiple updates. APT keeps tracks of which package installed which file and removes them when uninstalling a package.

Your system doesn't get slower if there are many packages installed (as long as you still have a reasonable amount of free disk space).

There is also no system wide registry as in Windows, but a lot of programs have configuration files in /etc. Usually it is better to not touch these files unless you know what you are doing. These configuration files are the only thing not deleted by APT when uninstalling a package (because you might want to use then again in the future). If you want to remove configurations files from uninstalled packages you can either call

dpkg --purge PACKAGENAME

for each package you want to remove or use

dpkg -l | awk '/^rc/ {print $2}' | xargs --no-run-if-empty sudo dpkg --purge

to remove configuration files of all uninstalled packages. However you should expect no speed up of your system.

Victor S.
  • 103
  • 5
R2D2
  • 161
  • 3
13

Below are cleanup system tools

  1. BleachBit

  2. Ubuntu Tweak

  3. GCleaner

  4. Sweeper

  5. Stacer: Linux Optimizer & monitoring open source

I got a vote list for above from here

enter image description here

And for removing unnecessary files follow below tools

  1. baobab - GUI
  2. ncdu - OUTPUT in CLI and also works remote servers via SSH.
  3. cruft

Hope this helps you.

11

The easiest way to clean up is to run this in Terminal:

sudo apt-get clean

If you want, you can install and run Bleachbit. It seems rather effective from what I've read, but it may just be doing the same thing that you can do manually. It just puts all the checkboxes in one place.

Daniel
  • 3,626
  • 3
  • 24
  • 46
4

Ubuntu Cleaner will remove the following in Ubuntu and its derivatives:

  • App caches
  • Browser caches
  • Apt cache
  • Package config files
  • Unneeded packages
  • Thumbnail cache
  • Old kernels

Installation

  1. To install Ubuntu Cleaner in Ubuntu , add the following PPA:

    sudo add-apt-repository ppa:gerardpuig/ppa
    
  2. Update the repository list using command:

    sudo apt-get update
    
  3. Then, install Ubuntu Cleaner as shown below.

    sudo apt-get install ubuntu-cleaner
    
Sid
  • 51
3

I have made a python script to clean Debian based Distros. OS Cleaner

This sript will clear the :

  • packages that are no longer required
  • Clean up APT cache
  • systemd journal logs
  • Clean the thumbnail cache

You can also check the garbage storages!