Display the size of one or more directories, subdirectories, and files by using the du command. Sizes are displayed in 512-byte blocks.
$ du [-as] [directory ...] |
du |
Displays the size of each directory you specify, including each subdirectory beneath it. |
-a |
Displays the size of each file and subdirectory, and the total number of blocks contained in the specified directory. |
-s |
Displays only the total number of blocks contained in the specified directory. |
directory ... |
Specifies one or more directories you want to check. |
The following example displays the sizes of two directories and all the subdirectories they contain.
$ du /var/log /var/cron 4 /var/log 3250 /var/cron |
The following example displays the sizes of two directories, all of the subdirectories and files they contain, and the total number of blocks contained in each directory.
$ du -a /var/log /var/cron 0 /var/log/authlog 0 /var/log/syslog 2 /var/log/sysidconfig.log 4 /var/log 3248 /var/cron/log 3250 /var/cron |
The following example displays the total sizes of two directories.
$ du -s /var/log /var/cron 4 /var/log 3250 /var/cron |