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 thought on “How to list files by their size?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s