I run the command unsuccessfully to get the size of directories (files inside belong to the size of a directory)
ls -lSrh
I get only kilobits for the size of directories while their content is more than that.
How can you list the size of directories including their content in the number by ls?
du -sh directory_name
ls
is going to give you the size of the directory entry, not of the directory contents. Based on my quick skim of man ls
there doesn't appear to be a way to make ls
dive down and calculate the size of the directories (most likely because it would be an expensive operation).
If you want to get directories size, you can use
du -sh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With