How can I find the size of files and directories on UNIX?


I use this UNIX command:

du -sk name

where name can be:
the name of a file (gives size of file in kilobytes), or
the name of a directory (gives size of directory, including subdirectories, in kilobytes), or
an asterisk (gives size of all files and directories, including subdirectories, in current directory in kilobytes), or
just enter du -sk without an argument (gives size of current directory, including subdirectories, in kilobytes).

For example, since your user name is bhrewert, if you want to see how large your home directory is, go one directory above it and enter
du -sk bhrewert

If you want to see which subdirectory of your home directory is the largest, go to your home directory and enter,
du -sk *
With this command the size of each file in your home directory and the size of each subdirectory of your home directory will be listed.  You can proceed down your directory tree in this manner.

There may be better ways, but using this command I can easily find where my largest directories are, so that I can work on deleting large files from them first.  Please let me know if anyone has a better method.

Thanks for the question, Randy