Sep 9, 2008

unix finding large files

Use the following commands to work out what directories / files are using most of the disk. Could be usefull to use as aliases.

find . -type d -exec du -sk {} \; sort -n

this command searches, from the current directory, looking at each directory and finding the size of that directory.

it then sorts the first column (size of the directory).

the command will size all directories under the current directory so all the directories at the high level will be last, but it does give a good idea where the large directories can be found.

find . -exec du -sk {} \; sort -n tail

use this command to find the largest 10 files from the current directory.

note: this command may take a long time to complete.