ISO27001:2013
Certified Supplier

FIND OUT MORE

We're an ISO27001:2013 Certified Supplier

blog-post-featured-image

Various Linux commands can present file and directory sizes in “human readable” format, where they append a “K” or “M”, etc, to indicate the file size; for example:

If we want to sort them by size, the sort command by itself isn’t much help. That’s because, by default, sort implements a lexical sort, and thus “2.1M” is sorted above “56K”, despite human beings recognising that the second is smaller:

In a short list, it’s easy to see that the mcollective.log.3 file is the largest, but what if we have a long list? The sort command now takes a “-h” qualifier which understands the “human readable” format:

Sorted, in more ways than one.

Could this Linux Tip be improved?

Let us know in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *