du (show disk space usage of files)

The command du (“disk usage”) shows how much space files and directories occupy on disk. It is most commonly called with the option -h (“human-readable”):

du -h somedir

In this example, du is used to show how much space somedir consumes. If you leave out the argument somedir, du will assume that you want to see the disk usage of the current directory. Here is some sample output:

8.0K     somedir/subdir1

484K    somedir/subdir2

496K    somedir

You'll notice that du works recursively, showing the sizes of subdirectories separately. If this is not what you want, use the -s option (“summarize”), which only shows the size of the top directory. When I'm running low on disk space, I call du -sh * in my home directory to find out which of my files and directories occupy the largest amount of disk space.