Sorting files on a file system by their size and looking for the largest file might not be accurate. Some file systems might contain files larger than the actual size occupied on the device. Such files might seem very large though it occupies only a few blocks. To find the number of blocks allocated for each file, use the disk usage (du) tool.
# du [-sh] [path ...]
The disk usage tool (du) checks all the files in a subtree, displays the number of blocks allocated for each file, and ends the list with a total sum of blocks. If no path is specified, the du tool performs its operation in the current working directory.
Use the –s option with the du command to display only the total sum for the subtree. The –h option changes the sizes to human readable format.
Example 17 Displaying Directory Space Usage SummaryThis example shows the output of the du command with total number of occupied blocks of all the directories under the /usr subtree.
# du -sh /usr/* 86K /usr/X11 30M /usr/apache2 146M /usr/bin 0K /usr/dict 44M /usr/gnu 49M /usr/include 0K /usr/java 157M /usr/jdk 1.9M /usr/kernel 1.3G /usr/lib 9K /usr/proc 0K /usr/pub 938K /usr/sadm 56M /usr/sbin 63K /usr/sfw 726M /usr/share 3.8M /usr/xpg4 914K /usr/xpg6 452K /usr/xpg7