[cs631apue] blocks (-s) & size (-k -h)

Jan Schaumann jschauma at stevens.edu
Fri Oct 17 22:47:43 EDT 2014

"xxu15 at stevens.edu" <xxu15 at stevens.edu> wrote:

> In the pdf, it is said -k(-h) modifies -s.
> But, -k(-h) is used to show the "st_size column", while -s is used to show the "st_blocks  column". So -k(-h) does not modifies -s, which is in conflict with what the ls.pdf said.

The '-k' modifies '-s' in that by default, '-s' will use 512 or the
value of BLOCKSIZE to calculate the number to print.  When '-k' is
specified, it will use 1024.

Likewise, '-h' will print humanized numbers instead of the full number.

You can verify this on linux-lab.cs.stevens.edu by running:

export BLOCKSIZE=512 # set default
ls -s
ls -sk

In the second output, you should find the same behaviour as if you had

export BLOCKSIZE=1024
ls -s


More information about the cs631apue mailing list