Ubuntu - Cleaning up configuration residue,packages


[Ubuntu] Cleaning up configuration residue,packages




[Ubuntu] Cleaning up configuration residue, packages ..


Under Ubuntu, like any operating system, obsolete or unnecessary files are not automatically destroyed.
It is possible to remove them to save space.

A special purpose software is being developed (still in beta)

Packages

Remove obsolete configuration files

  • Upon uninstalling a package, configuration files are not destroyed in anticipation of a future re-installation of the package.
  • To purge unused configuration files, use this command (in a terminal):
  • sudo dpkg --purge $(COLUMNS=200 dpkg -l | grep "^rc" | tr -s ' ' | cut -d ' ' -f 2)
  • Note that: it is also possible to delete the config files when uninstalling a package via
  • Synaptic, by checking the "complete removal".
  • Adept Manager using "Request Purge".
  • Using the --purge command.

sudo aptitude remove name-of-package --purge

Remove the packages in the cache


When you download and install packages, they are cached to avoid having to download them again.

To remove these packages, there are two commands that can be used: aptitude or apt-get (aptitude is better):
  • autoclean removes packages that can't be downloaded.
  • clean removes all cached package.

Therefore type:
sudo aptitude autoclean
sudo aptitude clean

Kernels


When the kernel is updated, older versions are still installed.
To remove a version of a kernel, you must know the exact name of the package, which is
linux-image-kernel.version-indexofimage-generic

The best way is to try and uninstall the old kernels via your package manager.
  • Start your manager root mode
    • kdesu adept_manager if you have kde and adept,
    • gksu synaptic for synaptic and Gnome (or Xfce)), then search for the "linux-image".
  • If you have adept, uncheck "not installed" in the display (below the search bar).
  • If you have synaptic, sort the packages installed first via the first column
  • If you have multiple versions of the kernel, or you have different images of the same kernel, you can uninstall the older ones.


It is advisable to always retain the last two versions at least. If an update should go wrong for the last kernel version, it is still possible to revert to an older version, instead of going through a liveCD.

Logfiles


The /var/log directory contains the logs of most services and software.
If they are useful for solving problems, still they occupy much space.

Most services perform a log rotation (in order to keep a limited number) or limit their size, but not always.

To be completed (or even delete old log files)

Recycle bin/Trash


Do not forget to empty the Trash bin regularly under Linux. For this, use the following command line:

rm -r -f ~/.local/share/Trash/files/*

Thumbnails of images


When you're browsing on the internet, Linux stores the thumbnails of images in order to facilitate their future loading ... Usually they are not removed.

The code below will allow the removal of miniatures over 7 days.

find ~/.thumbnails -type f -atime +7 -exec rm {} \;

Configuration residues in directories/home


Even though you have uninstalled a software and/or having their configuration files purged from the /etc directory, the software may have left the configuration files in the home directory of each user.
  • For example, the MPlayer software leaves files in the ~/.Mplayer directory.
  • It's the same for most applications.
  • Note that: These files may take significant proportions.
  • For example, Google Earth stores a cache (of at least 200MB) in the home directory of each user

Going further


To gain more space and remove other unnecessary files, you can also empty the trash.
  • Note that: for the partitions on external drives (USB keys, MP3 players, NTFS partition ...), Nautilus (the file browser of ubuntu) creates a folder.Trash-username containing the deleted files.
  • Remember to also delete this folder (Press CTRL + H in Nautilus to see hidden files).
  • To be completed

Automation of tasks

  • Simply create files containing these commands:
  • For obselete configuration files:
    pkg --purge $(COLUMNS=200 dpkg -l | grep "^rc" | tr -s ' ' | cut -d ' ' -f 2)
  • For packages stored in cache:
    sudo aptitude clean
  • And follow the instruction from this FAQ: Automate tasks with cron and init
Published by deri58 - Last update on June 16, 2010 01:57 PM by deri58
This document entitled « Ubuntu - Cleaning up configuration residue,packages » from Kioskea.net (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the licence, as this note appears clearly.
Suggestions
  •  Ubuntu - Cleaning up configuration residue,packages
  •  Installing a SSH server on Ubuntu » Tips : SSH server allows users to connect remotely in a secure way and allows access to file transfers. Installation of the SSH server on Ubuntu requires the use of command 'sudo aptitude install ssh' and through the Login ID and the password reported in...
  •  Ubuntu install tar.gz package (Solved) » Best answer: unzip the the file using $tar -zxvf program.tar.gz $tar -zjvf program.tar.bz2 change directory into unzipped folder ie.. cd /download/program/ ./configure make and the get into root ie.. sudo su (for suse su is enough) and enter your password
  •  Ubuntu - Installing an HTTP proxy server (Squid) » Tips : A proxy server on network can be useful regarding security. Proxy servers can also act as a cache that enables users to get faster internet access. At the same time, this server allows them to share downloads more easily. Squid is a web proxy server...
  •  Linux - Restarting the network interface using command lines » Tips : Restarting the network interface using command lines in Linux is a straight-forward procedure. While the GUI for Linux network configuration is more graphical and visually appeasing, it may take longer to restart the network interface by using it. In...
  •  Ubuntu - change default application to open a file » Tips : Linux Distributions are the UNIX like Office Software which includes a huge collection of software and database applications. Ubuntu is a free and open source operating system which is based on the Debian (uses Linux kernel) Linux Distributions....
Ubuntu - Set Thunderbird in French
Installing Ubuntu-restricted-extras package behind a proxy