Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Human Readable ls and df commands (See related posts)

Simple but useful to know...

To get a ls (file list) or df (disk free) to show in K,M or G instead of *huge* numbers of bytes without commas, use the -h flag.

ls -lh
df -h

Comments on this post

prolix876 posts on Sep 08, 2007 at 07:01
The -h is useful, but I prefer to use the long GNU-style options as there are two varieties: One for 1000-based numbers and one for 1024-based:

For a file sized 6,582,637 bytes,
ls -l --human-readable
returns 6.3M while
ls -l --si
returns 6.6M. Depending on the particular version of ls(1) or df(1), -h could vary, resulting in confusion.

You need to create an account or log in to post comments to this site.


Related Posts