[phasnip@mijpnb1 Linux]$ df Filesystem 1k-blocks Used Available Use% Mounted on /dev/hda5 2008108 1364996 541104 72% / none 127764 0 127764 0% /dev/shm /dev/hda7 1818352 1223956 502024 71% /home /dev/hda1 6644480 5266840 1377640 80% /mnt/windows /dev/hda8 806368 542784 222620 71% /usr/local
This tells you how much space is free on each storage device in the computer. The first column is the device (every device in the computer has a special file in /dev), and the last column tells you the mount point for the device. The space is reported in terms of blocks, which is Linux's measure of space. This may not be kilobytes, but you can force this using df -k. Some implementations also have a -h switch to report sizes in the most human-readable format.
To find out how much disk space is being used by a directory tree use du,
[phasnip@mijpnb1 ~/Teaching]$ du -h 8.0k ./Linux/Junk 772k ./Linux 980k .
Notice that the du command gives the space of all subdirectories as well, but that the space for low-level directories is also included in their parent directories.
Because du lists all the subdirectories the output can be overwhelming. Usually we are only interested in the top few directories, so it makes sense to pipe the output through grep
[phasnip@mijpnb1 ~]$ du -h | grep -v '/.*/' 4.1M ./.kde 152k ./.gnome 68k ./Desktop 592k ./.mcop 320k ./.gconf 11M ./.galeon 980k ./Teaching 1.3M ./Rules 58M .You can see that the total disk space used is 58 megabytes, and the largest subdirectory is called `.galeon'.