Listing files by size


There are lots of ways to list files and sort by their size with the help of pipe operator, for example:

ls -l | sort -n -k 5

But ls command already has builtin support for this:

ls --sort=size -l

you can reverse the list with -r option:

ls --sort=size -lr

or you may add -h (human-readable) parameter for good looking:

ls --sort=size -lrh