# 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 response to “How to list files by their size?”

  1. Paul Avatar
    Paul

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

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

    I like your site!

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.