du
- list the sizes of a folder and any subfolders
Syntax
Options
Option |
Description |
-a |
Show file sizes too |
-L |
Follow all symlinks |
-H |
Follow symlinks on command line |
-d N |
Limit output to directories (and files with -a) of depth < N |
-c |
Show grand total |
-l |
Count sizes many times if hard linked |
-s |
Display only a total for each argument |
-x |
Skip directories on different filesystems |
-h |
Sizes in human readable format (e.g., 1K 243M 2G) |
-m |
Sizes in megabytes |
-k |
Sizes in kilobytes (default) |
Examples
List sizes of a folder and any subfolders
sample ouput
1 2 3 4 5
| du -h /usr/local 44.0K /usr/local/bin 4.0K /usr/local/share 4.0K /usr/local/lib 56.0K /usr/local
|
List sizes of all contents in a folder
sample output
1 2 3 4 5
| 40.0K /usr/local/bin/envsubst 44.0K /usr/local/bin 4.0K /usr/local/share 4.0K /usr/local/lib 56.0K /usr/local
|
List sizes of a folder and any subfolders(deep 1)
sample output
1 2 3 4 5 6 7
| 360.0K /usr/bin 3.3M /usr/share 6.2M /usr/lib 2.6M /usr/sbin 56.0K /usr/local 4.0K /usr/src 12.6M /usr
|
list sizes of .png files in current folder
Reference