[Ilugc] Fwd: LJ Tech Tip

  • From: sbharathi@xxxxxxxxxxxxx (Bharathi Subramanian)
  • Date: Wed Apr 11 18:07:31 2007

LJ TECH TIP:

This tech tip comes from the book Beginning Ubuntu Linux by Keir
Thomas (Apress):

After using Ubuntu for some time, you might find that the disk begins
to get full.  You can keep an eye on disk usage by using the following
command in a GNOME Terminal window:

   df -h

This will show the free space in terms of megabytes or gigabytes, and
also expressed as a percentage figure. If the disk does start to get
full, you can take some steps to make space more available.

* Emptying the /tmp Folder

An easy way to regain disk space is to empty the /tmp folder.  As with
the Windows operating system, this is the folder in which temporary
data is stored.  Some applications clean up after themselves, but
others don't, leaving behind many megabytes of detritus.

Because the /tmp folder is accessed practically every second the
system is up and running, to empty it safely, it's necessary to switch
to run level 1.  This insures few other programs are running and
avoids the risk of deleting data that's in use.  The following series
of commands will switch to run level 1, empty the /tmp folder, and
then reboot afterwards:

      sudo killall gdm
      [login with your username and password]
      sudo init 1
      rm -rf /tmp/*
      reboot

Tip: On a similar theme, don't forget to empty the desktop
Wastebasket. This can hold many megabytes of old data.

* Emptying the Cache of Package Files

You might also choose to clear out the Advanced Packaging Tool (APT)
cache of old .deb package files.  On a system that has been very
frequently updated, this can free many megabytes (possibly gigabytes)
of space.

You can empty the cache by typing the following command in a GNOME
Terminal window:

     sudo rm -f /var/cache/apt/archives/*.deb

Caution! Be careful to type the command to empty the APT cache exactly
as it is written.  Even inserting an additional space can lead to very
bad consequences.

If you want to restore any packages later on, simply locate them in
the Synaptic Package Manager list, click the check box, and click Mark
for Reinstallation.  This will cause the package to be downloaded,
installed and configured.

HTH :)
--
Bharathi S

Other related posts: