Show ls File Sizes with Commas

This page answers questions like these:


Related Links:
File Size in Bytes using a Shell Command
Count Occurrences of a Hexadecimal Sequence in a File
Count Occurrences of a String in a File
Find Positions of a Hexadecimal Sequence in a File
Join Lines of Text File Together
Output Lines of a File in Reverse Order
Output the Lines Between Two Matching Lines



Show ls File Sizes with Commas – Modern Solution:

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

LC_NUMERIC=en_US.UTF-8 ls -l --block-size="'1"
OR

LC_ALL=en_US.UTF-8 ls -l --block-size="'1"
OR

LC_ALL=en_US.UTF-8 BLOCK_SIZE="'1" ls -l
OR

export LC_ALL=en_US.UTF-8 export BLOCK_SIZE="'1" ls -l

Show ls File Sizes with Commas – Old-Fashioned Solution:

ls -l | sed -e 's/\( [0-9 ][0-9 ][0-9] [JFMASOND][aepuco][bcgrlnptvy] \)/ \1/' \ -e 's/\([0-9]\)\([0-9][0-9][0-9] [JFMASOND][aepuco][bcgrlnptvy] \)/\1,\2/' \ -e 's/\( [0-9 ][0-9 ][0-9 ][ ,][0-9 ][0-9 ][0-9] [JFMASOND][aepuco][bcgrlnptvy] \)/ \1/' \ -e 's/\([0-9]\)\([0-9][0-9][0-9],[0-9][0-9][0-9] [JFMASOND][aepuco][bcgrlnptvy] \)/\1,\2/' \ -e 's/\( [0-9 ][0-9 ][0-9 ][ ,][0-9 ][0-9 ][0-9 ][ ,][0-9 ][0-9 ][0-9] [JFMASOND][aepuco][bcgrlnptvy] \)/ \1/' \ -e 's/\([0-9]\)\([0-9][0-9][0-9],[0-9][0-9][0-9],[0-9][0-9][0-9] [JFMASOND][aepuco][bcgrlnptvy] \)/\1,\2/' \ -e 's/ \([^ ]*[0-9] [JFMASOND][aepuco][bcgrlnptvy] \)/\1/'


Related Links:
File Size in Bytes using a Shell Command
Count Occurrences of a Hexadecimal Sequence in a File
Count Occurrences of a String in a File
Find Positions of a Hexadecimal Sequence in a File
Join Lines of Text File Together
Output Lines of a File in Reverse Order
Output the Lines Between Two Matching Lines

Home  >  Linux / Unix  >  Show ls File Sizes with Commas


Tags: ls with commas, file size with commas, filesize with commas, file size commas, filesize commas, ls filesize commas, ls file size commas, show commas in ls, ls -l, thousands separator, linux, unix, solaris, bsd, aix

Copyright © HelpDoco.com
file-size-with-commas-in-ls.txt
Linux-Unix/ls-file-size-with-commas.htm
2