Is there a simple command to display the total aggregate size (disk usage) of all files in a directory (folder)?
I have tried these, and they don't do what I want:
ls -l, which only displays the size of the individual files in a directory, nor
df -h, which only displays the free and used space on my disks.
du"summarizes disk usage of each FILE, recursively for directories," e.g.,
-his to get the numbers "human readable", e.g. get
143260(size in KBytes)
-sis for summary (otherwise you'll get not only the size of the folder but also for everything in the folder separately)
As you're using
-hyou can sort the human readable values using
sortwill consider "Human Readable" size values.
If want to avoid recursively listing all files and directories, you can supply the
--max-depthparameter to limit how many items are displayed. Most commonly,