You are not logged in.
Pages: 1
On my system I have this peculiar problem. The command 'ls -lk' does not show in kilobytes, rather in bytes:
[abcd@myhost dropbox]$ ls -lk
total 44580
-rw-r--r-- 1 cardio users 27846860 May 31 12:15 dropbox-1.4.7-1-i686.pkg.tar.xz
-rw-r--r-- 1 cardio users 288 Sep 5 2011 dropbox.desktop
-rw-r--r-- 1 cardio users 17765299 May 31 12:14 dropbox-lnx.x86-1.4.7.tar.gz
-rw-r--r-- 1 cardio users 9896 May 29 2011 dropbox.png
-rw-r--r-- 1 cardio users 1597 May 25 15:46 PKGBUILD
-rw-r--r-- 1 cardio users 12278 Sep 5 2011 terms.txt
[abcd@myhost dropbox]$
I checked aliases. It only shows following:
[abcd@myhost dropbox]$ alias
alias ls='ls --color=auto'
[abcd@myhost dropbox]$
I could not find posts on this in forums, wiki or google. The man page says -k option should show in kilobytes. Thanks for your help.
Offline
Run
ls -lhEidt: the '-k' option refers to the block size:
-k, --kibibytes
use 1024-byte blocks
Last edited by bohoomil (2012-05-31 07:05:11)
:: Registered Linux User No. 223384
:: github
:: infinality-bundle+fonts: good looking fonts made easy
Offline
Command 'ls -lh' works well but why the -k option does not work?
Offline
'-k' option works, but not in the way you expect it to. It refers to the way ls computes size values. I'm just wondering if what you want is simply a thousand separator, e.g.:
-rw-r--r-- 1 bohoomil users 1,672,702 May 26 22:10 article.pdfIf so, you have to do something different: create an alias to ls in your .bashrc, like this:
alias ls="BLOCK_SIZE=\'1 ls -F --color=auto"After you restart your terminal, run 'ls -lh' as suggested above and see if you get what you want.
:: Registered Linux User No. 223384
:: github
:: infinality-bundle+fonts: good looking fonts made easy
Offline
The man page is kinda sparse, so here's some additional detail from the info page:
`-k'
`--kibibytes'
Set the default block size to its normal value of 1024 bytes,
overriding any contrary specification in environment variables
(*note Block size::). This option is in turn overridden by the
`--block-size', `-h' or `--human-readable', and `--si' options.
The `-k' or `--kibibytes' option affects the per-directory block
count written by the `-l' and similar options, and the size
written by the `-s' or `--size' option. It does not affect the
file size written by `-l'.Offline
I had used this command earlier and I tried again the command 'ls -lk' in other (U...know..which) distro and it works as expected (eg 4 instead of 4125 is shown).
But this is hardly a problem. I have now got used to typing 'ls -lh' .
I really like the tip about the thousand separator. Thanks.
Last edited by rnarch (2012-05-31 12:25:43)
Offline
Pages: 1