How to Display File Size in Human Readable Format (KB, MB, GB) in Linux Terminal

You probably already know that you can use ls command with long listing option -l to show file size in Linux.

But unfortunately the long listing shows the file size in blocks and that8217s not of much use to us humans. .

Good thing is that you can combine the option -l with -h to show the file size in human readable format.

As you can see it is better to display file size in human-readable format.

As you can see file sizes are now displayed in K for KB M for MB. If the file size is in Bytes it is not displayed with any suffix. In the above example is 140 Bytes in size.

Did you notice the size of newdir directory It is 4 KB. If you use ls -lh command on directories it always shows the size of directory as 4.0 K. .


Read Full Post

News Link:
RSS Link:

Linux Chatter is a news aggregator service that curates some of the best Linux, Cloud, Technical Guides, Hardware and Security news. We display just enough content from the original post to spark your interest. If you like the topic, then click on the 'read full post' button to visit the author's website. Use Linux Chatter to find content from amazing authors!

Note: The content provided has been modified and is not displayed as intended by the author. Any trademarks, copyrights and rights remain with the source.

Disclaimer: Linux Chatter sources content from RSS feeds and personal content submissions. The views and opinions expressed in these articles are those of the authors and do not necessarily reflect those of Linux Chatter.