Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I use the UNIX ls command to display sizes of folder contents?

Hello,


Say I run the command ls -lohS in terminal on my Home directory...


Mac-Pro:~ mike$ ls -lohS

total 0

drwx------+ 57 mike 1.9K Aug 31 16:52 Library

drwx------+ 32 mike 1.1K Sep 14 16:58 Desktop

drwx------+ 13 mike 442B Sep 9 18:25 Pictures

drwx------+ 12 mike 408B Sep 9 18:25 Documents

drwx------+ 8 mike 272B Sep 9 18:25 Downloads

drwx------+ 5 mike 170B Sep 9 18:25 Movies

drwx------+ 5 mike 170B Sep 9 18:25 Music

drwxr-xr-x+ 5 mike 170B Sep 9 18:25 Public

drwxr-xr-x+ 5 mike 170B Sep 9 18:25 Sites

drwxr-xr-x 2 mike 68B Dec 3 2010 Applications


I don't know what that size column shows for folders, but it's certainly not the size of the contents of the folder. How can I display this list, but with the sizes of the entire contents of each folder, including all of its subfolders?


Basically, I need the Terminal equivalent of opening my Home folder in Finder, Clicking Show View Options, clicking Calculate All Sizes, and then sorting the Size column descending.


Thanks for any help you can give!


-Mike

Posted on Sep 14, 2011 3:47 PM

Reply
Question marked as Best reply

Posted on Sep 14, 2011 4:01 PM

du

See man page for options.

For example:

du -hd1 ~

du -kd1 ~

2 replies

How can I use the UNIX ls command to display sizes of folder contents?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.