How can I show file sizes with commas when getting a directory listing with 'ls -l'? How can I show file sizes with commas when getting a directory listing with 'ls -l'? unix unix

How can I show file sizes with commas when getting a directory listing with 'ls -l'?


I just discovered that it's built-in to GNU Core Utils and works for ls and du!

ls -l --block-size="'1"du --block-size="'1"

It works on Ubuntu but sadly doesn't on OSX. More on variants of block size here


If the order of magnitude is all you're interested in, ls -lh does something like this:

-rw-r----- 1 alice themonkeys 626M 2007-02-05 01:15 foo.log-rw-rw-r-- 1 bob   bob        699M 2007-03-12 23:14 bar.txt


I don't think 'ls' has exactly that capability. If you are looking for readability, 'ls -lh' will give you file sizes that are easier for humans to parse.

-rw-rw-rw-  1 alice themonkeys 1.2G 2008-08-20 07:01 foo.log-rw-rw-rw-  1 bob   bob        244M 2008-08-20 05:30 bar.txt