How to list files by their size?

# Using ls and sort one can sort the files by their size, here is what the options means
# ls -l – means print the file in long format, prints access, woner, group, size, last update and name
# sort -n -k5 – sort using numeric, -k5 field number to sort by
$ ls -l | sort -n -k5

One comment

  1. Hi,
    I always sort (on Suse Linux) using:

    ls -lS (decreasing list)
    ls -lSr (increasing list)

    I like your site!

Leave a Reply