How do I sort a Unix directory listing by file size?

By Alvin J. Alexander, devdaily.com

On Mac OS X this command works for me:

ls -alS

That lists the files in order, from largest to smallest. To reverse the listing so it shows smallest to largest, just add the 'r' option to that command:

ls -alSr

devdaily logo