Dired Ordering by Size

By default dired orders its files in alphanumeric order and when s is selected it sorts by date according to :

(dired-sort-toggle-or-edit &optional ARG)

But recently I wanted to list files according to their size, which of course is a very common thing to do especially when you are undertaking a nice spring clean up.

The solution is to modify the dired-listing-switches to add in an S argument which can be found by passing in the universal argument to s, hence : C-u s

This presents the user with something like: -al at which point you can just tack S on the end to show -alS

as the ls man page states the following:

-S     sort by file size, largest first

and this is what we get:

a nice ordered listing, it is not something I do often and generally the standard dired sort toggle is all I need, but it is nice to know that this is available.

Comments

comments powered by Disqus