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
> du -shc images
173M	images
173M	total

> du -sh navigation.gif
116K	navigation.gif

Read more about it the docs

Instagram Post