The *nix command
ls returns lots of useful information, particularly with the
-alh flags, to display permissions, owner, group, modification date, file name, and human-readable size for all files and directories within the current directory.
Well, sort of.
It falls short on directory size, treating the directory like a file and returning only the size of the directory itself, helpfully ignoring its contents.
To return size information for files and directories, we can use
du, which stands for disk usage.
Some useful flags include:
-ssummarizes directory information into a single line (leave off to see file sizes for the directory contents as well)
-hconverts size information into human-readable form (e.g.
-cappends the list with the total disk space used
You can either name the directory or use the * wildcard to return sizes for everything:
:: Return the size of a specific directory ("tmp" in this example) du -sh tmp :: Or return the size of all files and directories within the current directory du -shc *