diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index cb45555e1582..f43ae52b382c 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -104,6 +104,9 @@ symbolic links in the argument list are not indirected through. Output is not sorted. .It Fl i For each file, print the file's file serial number (inode number). +.It Fl k +If the 's' option is specified, print the file size allocation in kilobytes, +not blocks. .It Fl l (The lowercase letter ``ell.'') List in long format. (See below.) If the output is to a terminal, a total sum for all the file diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 1cea616821d2..db1ee39a4f66 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -75,6 +75,7 @@ int f_accesstime; /* use time of last access */ int f_column; /* columnated format */ int f_flags; /* show flags associated with a file */ int f_inode; /* print inode */ +int f_kblocks; /* print size in kilobytes */ int f_listdir; /* list actual directory, not contents */ int f_listdot; /* list files beginning with . */ int f_longform; /* long listing format */ @@ -119,7 +120,7 @@ main(argc, argv) f_listdot = 1; fts_options = FTS_PHYSICAL; - while ((ch = getopt(argc, argv, "1ACFLRTacdfgiloqrstu")) != EOF) { + while ((ch = getopt(argc, argv, "1ACFLRTacdfgikloqrstu")) != EOF) { switch (ch) { /* * The -1, -C and -l options all override each other so shell @@ -175,6 +176,9 @@ main(argc, argv) case 'i': f_inode = 1; break; + case 'k': + f_kblocks = 1; + break; case 'o': f_flags = 1; break; @@ -218,7 +222,9 @@ main(argc, argv) /* If -l or -s, figure out block size. */ if (f_longform || f_size) { (void)getbsize(¬used, &blocksize); - blocksize /= 512; + blocksize /= 512; + if (f_kblocks) + blocksize *= 2; } /* Select a sort function. */