Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It is possible to make ls -l output the size field with digits grouped by thousands? If so, how?

For instance:

$ ls -l
-rw-rw---- 1 dahl dahl 43,210,052 2012-01-01 21:52 test.py

(Note the commas in the size).

Maybe by modifying the LC_NUMERIC setting inside the locale I'm using (en_US.utf8)?

I'm on Kubuntu 12.04 LTS.

share|improve this question
How big is test.py? Do you want bytes, kilobytes, megabytes, ...? – Mikel Aug 7 '12 at 4:26
up vote 13 down vote accepted

Block size - GNU Coreutils says

A block size specification preceded by ' causes output sizes to be displayed with thousands separators. (Note well that just specifying a block size is not enough).

So depending on what you want, you could try

BLOCK_SIZE="'1" ls -l
BLOCK_SIZE="'1kB" ls -l


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

you can make it permanent using

export BLOCK_SIZE="'1"
export BLOCK_SIZE="'1kB"


alias ls="ls --block-size=\"'1\""
alias ls="ls --block-size=\"'1kB\""
share|improve this answer

From the man pages

          scale sizes by SIZE before printing them.  E.g., `--block-size=M'   
          prints sizes in units of 1,048,576 bytes.  See SIZE format below.

_Here is the man page for ls, remember man is your best friend type "man man" in your terminal to find out how useful it can be.


List information about files.

      ls [Options]... [File]...

      Sort entries alphabetically if none of -cftuSUX nor --sort.

  -a, --all                  Do not hide entries starting with .

  -A, --almost-all           Do not list implied . and ..

  -b, --escape               Print octal escapes for nongraphic characters

      --block-size=SIZE      Use SIZE-byte blocks

  -B, --ignore-backups       Do not list implied entries ending with ~

  -c                         Sort by change time; with -l: show ctime

  -C                         List entries by columns

      --color[=WHEN]         Control whether color is used to distinguish file
                             types. WHEN may be `never', `always', or `auto'

  -d, --directory            List directory entries instead of contents

  -D, --dired                Generate output designed for Emacs' dired mode

  -f                         Do not sort, enable -aU, disable -lst

  -F, --classify             Append indicator (one of */=@|) to entries

      --format=WORD          Across -x, commas -m, horizontal -x, long -l,
                             single-column -1, verbose -l, vertical -C

      --full-time            List both full date and full time

  -g                         (ignored)

  -G, --no-group             Inhibit display of group information

  -h, --human-readable       Print sizes in human readable format (e.g., 1K 234M 2G)
  -H, --si                   Likewise, but use powers of 1000 not 1024

      --indicator-style=WORD Append indicator with style WORD to entry names:
                             none (default), classify (-F), file-type (-p)

  -i, --inode                Print index number of each file

  -I, --ignore=PATTERN       Do not list implied entries matching shell PATTERN

  -k, --kilobytes            Like --block-size=1024

  -l                         Use a long listing format

  -L, --dereference          List entries pointed to by symbolic links

  -m                         Fill width with a comma separated list of entries

  -n, --numeric-uid-gid      List numeric UIDs and GIDs instead of names

  -N, --literal              Print raw entry names (don't treat e.g. control
                             characters specially)

  -o                         Use long listing format without group info

  -p, --file-type            Append indicator (one of /=@|) to entries

  -q, --hide-control-chars   Print ? instead of non graphic characters

      --show-control-chars   Show non graphic characters as-is (default)

  -Q, --quote-name           Enclose entry names in double quotes
      --quoting-style=WORD   Use quoting style WORD for entry names:
                             literal, shell, shell-always, c, escape

  -r, --reverse              Reverse order while sorting

  -R, --recursive            List subdirectories recursively

  -s, --size                 Print size of each file, in blocks

  -S                         Sort by file size

      --sort=WORD            time -t, version -v, status -c 
                             size -S, extension -X, none -U
                             atime -u, access -u, use -u

      --time=WORD            Show time as WORD instead of modification time:
                               atime, access, use, ctime or status; 
                               also use this as a sort key if --sort=time

  -t                         sort by modification time

  -T, --tabsize=COLS         assume tab stops at each COLS instead of 8

  -u                         sort by last access time; with -l: show atime

  -U                         do not sort; list entries in directory order

  -v                         sort by version

  -w, --width=COLS           assume screen width instead of current value

  -x                         list entries by lines instead of by columns

  -X                         sort alphabetically by entry extension

  -1                         list one file per line

      --help                 display help and exit

      --version              output version information and exit
share|improve this answer
press "q" to quit btw, this took me a while to figure out when I first installed Red Hat when I was 10 lol – Joe Aug 7 '12 at 1:31
Thank you for the reply, but I'm not looking to scale the size. I'm looking to display the size in bytes, with grouping. – Roger Dahl Aug 7 '12 at 1:31
you can use the --block-size=1000 that would break the size field down – Joe Aug 7 '12 at 1:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.