Insert commas to make reading numbers easier in the output of ls

/bin/ls -lF "$@" | sed -r ': top; s/. ([0-9]+)([0-9]{3}[,0-9]* \w{3} )/ \1,\2/ ; t top'
This modifies the output of ls so that the file size has commas every three digits. It makes room for the commas by destructively eating any characters to the left of the size, which is probably okay since that's just the "group".   Note that I did not write this, I merely cleaned it up and shortened it with extended regular expressions. The original shell script, entitled "sl", came with this description:    : '  : For tired eyes (sigh), do an ls -lF plus whatever other flags you give  : but expand the file size with commas every 3 digits. Really helps me  : distinguish megabytes from hundreds of kbytes...  :  : Corey Satten, corey@cac.washington.edu, 11/8/89  : '   Of course, some may suggest that fancy new "human friendly" options, like "ls -Shrl", have made Corey's script obsolete. They are probably right. Yet, at times, still I find it handy. The new-fangled "human-readable" numbers can be annoying when I have to glance at the letter at the end to figure out what order of magnitude is even being talked about. (There's a big difference between 386M and 386P!). But with this nifty script, the number itself acts like a histogram, a quick visual indicator of "bigness" for tired eyes. :-)
Sample Output
# Note that this command is designed to be kept in a script called "sl"
hardy%  sl /var/log/apache2/ 
total 436376
-rw-r--r-- 1 root ro 420,341,429 Sep 29 07:03 access.log
-rw-r--r-- 1 root roo 22,671,391 Sep 29 06:49 error.log
-rw-r--r-- 1 root root 3,272,040 Jan 20  2013 gallery_access.log
-rw-r--r-- 1 root root    99,837 Jan 20  2013 gallery_error_log

What Others Think

Succeed! It could be one of the most useful blogs we have ever come across on the subject. Excellent info! I’m also an expert in this topic so I can understand your effort very well. Thanks for the huge help. ????????
KayGasaway · 34 weeks and 1 day ago
I genuinely believed you would probably have something useful to say. All I hear is a bunch of whining about something that you can fix if you were not too busy looking for attention. After all, I know it was my choice to read.. https://gamebnat.net/mtsite10/
KayGasaway · 34 weeks ago
If you don"t mind proceed with this extraordinary work and I anticipate a greater amount of your magnificent blog entries. http://www.theamcl-399.org/top-five-things-an-injured-worker-should-do-in-texas/">kroger online schedule
KayGasaway · 33 weeks and 6 days ago
Particular interviews furnish firsthand message on mart size, industry trends, ontogeny trends, capitalist landscape and outlook, etc. https://first-11.net/muk02/
KayGasaway · 33 weeks and 2 days ago
That is the excellent mindset, nonetheless is just not help to make every sence whatsoever preaching about that mather. Virtually any method many thanks in addition to i had endeavor to promote your own article in to delicius nevertheless it is apparently a dilemma using your information sites can you please recheck the idea. thanks once more. CNPR Reviews
KayGasaway · 32 weeks and 5 days ago
This is very interesting content! I have thoroughly enjoyed reading your points and have come to the conclusion that you are right about many of them. You are great. https://first-11.net
KayGasaway · 32 weeks and 4 days ago
This is very interesting content! I have thoroughly enjoyed reading your points and have come to the conclusion that you are right about many of them. You are great. https://first-11.net
KayGasaway · 32 weeks and 4 days ago
Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. ??????
KayGasaway · 31 weeks and 5 days ago
Great post, you have pointed out some fantastic points , I likewise think this s a very wonderful website. ?????
KayGasaway · 31 weeks and 2 days ago
It turns out that even the hottest port has a few places where you can get off the beaten path. Here are some recommendations that will make you feel like you're in the know Circle Healthcare reviews
KayGasaway · 30 weeks ago
This article is an engaging abundance of enlightening information that is intriguing and elegantly composed. I praise your diligent work on this and thank you for this data. You have what it takes to get consideration. Gym Near Me
KayGasaway · 19 weeks and 1 day ago
Fabric Flair provides a massive collection of hand dyed cross stitch fabric and linen. We provide high-quality evenweave and plain weave 100% cotton fabrics. Lace Fabric, Linen Lace
jackson2321 · 19 weeks ago
Fabric Flair provides a massive collection of hand dyed cross stitch fabric and linen. We provide high-quality evenweave and plain weave 100% cotton fabrics. Newsprint Fabric
jackson2321 · 19 weeks ago
If you don"t mind proceed with this extraordinary work and I anticipate a greater amount of your magnificent blog entries. finocchiona
KayGasaway · 19 weeks ago
Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon. ???? ??? ????
KayGasaway · 17 weeks and 6 days ago
A lot of people having an incorrect image about the cash advance loans or sometimes refer it as bad credit payday loans. ???? ???? ??????
ayesha · 16 weeks and 6 days ago
Your article is extremely helpful exceptionally fascinating subject i am looking that sort of post thank for imparting to us keep it up. juegos mlb en vivo por internet gratis
KayGasaway · 16 weeks ago
Extremely pleasant article, I appreciated perusing your post, exceptionally decent share, I need to twit this to my adherents. Much appreciated!. Personal Trainers San Diego
KayGasaway · 16 weeks ago
Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking. Minnesota photographer
KayGasaway · 15 weeks and 2 days ago
pleasant post, stay aware of this fascinating work. It truly regards realize that this subject is being secured likewise on this site so cheers for setting aside time to talk about this! Gym Near Me
KayGasaway · 15 weeks and 2 days ago
Thanks for the tips guys. They were all great. I have been having issues with being fat both mentally and physically. Thanks to you guys i have been showing improvements. Do post more. weed concentrates
jackson2321 · 6 days ago
Thanks for the tips guys. They were all great. I have been having issues with being fat both mentally and physically. Thanks to you guys i have been showing improvements. Do post more. weed concentrates
jackson2321 · 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: