Saturday 2 January 2010

TIP: How to free space on hard drive

To view the amount of used and free space on your hard drive:


Disk usage in bytes
Code:   
df
   


more human readable form, usage in Gbytes and Mbytes.
Code:   
df -h
   


KDiskFree (kdf)
KDiskFree displays the available file devices (hard drive partitions, floppy and CD drives, etc.) along with information on their capacity, free space, type and mount point. It also allows you to mount and unmount drives and view them in a file manager.
docs.kde.org/stable/en/kdeutils/kdf/

How to free space on hard drive
I was going to upgrade from Kubuntu Jaunty Jackalope (9.04) to Karmic Koala (9.10) but the installer was failing due to not enough free space in root (/). A bit of browsing and I threw together the following tips.

Empty Trash - You should regularly keep your trash can empty. Via the desktop os easy or, via bash:
Code:   
rm -rf ~/.Trash/*
   


To delete all but the last 7 days of files from Trash:
Code:   
$find ~/.Trash -type f -atime +7 -exec rm {} \;
   


Downloaded packages - Downloaded .debs packages that have been downloaded get put in /var/cache/apt/archive, you can remove everything from this directory, except "lock" and "partial" safely.
Code:   
sudo rm /var/cache/apt/archives/*.deb
   

or, you could go to Synaptic and in Settings->Preferences->Files click the 'Delete Cached Packages Files' button.

Note:- There is an option in Synaptic
(Settings->Preferences->Files) to just not keep .deb files after using them for installation.

Removing unused package files - When you install a package APT retrieves the needed files. In time the local repository can grow and occupy a lot of disk space. Fortunately, APT provides tools for managing its local repository: apt-get's clean and autoclean methods.

apt-get clean removes everything except lock files.

apt-get autoclean removes only package files that can no longer be downloaded.
Code:   
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get clean
sudo apt-get autoclean
   

www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html

File Manager (Nautilus, Dolphin, etc.) - The file manager stores thumbnails (small images) of image, pdf and other files. You could clear out your ~/.thumbnails to free a bit of space.
Code:   
rm -rf ~/.thumbnails/normal/*
rm -rf ~/.thumbnails/large/*
   


A great way to clean up lots of old thumbnails that you have not looked at in 7 days:
Code:   
$find ~/.thumbnails -type f -atime +7 -exec rm {} \;
   




Categories: How-To, Linux, OS
Tags: Ubuntu, Kubuntu, administration, commands, maintenance, disk space.

No comments: