On older versions of Linux and Unix, you can use this command.
The “[JFMASOND][aepuco][bcgrlnptvy]” pattern is used to match the standard 3-letter English month abbreviations, to reduce the chance of a bad match when ls shows the date differently for files more than 12 months old.
You can alter the “[JFMASOND][aepuco][bcgrlnptvy]” pattern to handle languages other than English.
You can alter the “\1,\2” pattern to use a different thousands separator.
The last line of the sed command removes spaces to help cope with the fact that commas have been added. This may cause small and large file sizes to not align vertically.
Pros: Works on all Unix/Linux systems. Handles file sizes up to 999,999,999,999 bytes.
Cons: Slow. Large file sizes may not align correctly.
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