Get Size Of A Directory Or File
Need to get the size of a directory in linux? Use the du command to output the size of a file or directory. Use the flags to give a more useful output.
-s, --summarize Display only a total for each argument
-h, --human-readable Print sizes in human readable format, e.g. 1K, 324M
-c, --total Produce a grand total
-a, --all write counts for all files, not just directories> du -shc images
173M images
173M total
> du -sh navigation.gif
116K navigation.gifIf you want to see which directories are taking up the most room on your system you can
use the -a flag and sort by which is taking up the most space:
du -ahm | sort -nr | headRead more about it the docs