Wikipedia

Search results

11 February 2021

Sort directories by size in OSX

 In the Terminal application we'll be using the du command.



Let's specify depth as one so to avoid listing files and subdirectories, and the output in gigabytes. I know this particular folder is roughly 9 gigabytes overweight, and I'm looking for a > 5g whale.

Before that, let's pipe it to a sort operation to list directories by size in descending order with sort. This will take the -n option to sort by number and -r to list in reverse (descending) order.


Found it!