I found the command du
is different on Mac compared with Linux. A little bit of confusion.
Here is a note how to use du
on different OS.
du on Mac
List the size of current directory, the option -h is displaying in human friendly format, the option -s is not recursive to display all sub-directories:
|
List all the size of sub-directories in current directory:
|
If you want to sort according to the size, use pipeline and sort:
|
If you want to know which directory cost most disk space, another handy util command line is ncdu
. You could install it via homebrew:
|
The result is like this:
du on Linux
Linux du have the option –max-depth to limit the depth:
|
Join my Email List for more insights, It's Free!😋