On 12/3/18 1:41 pm, Ed Greshko wrote:
On 03/12/18 09:41, Stephen Morris wrote:
Thanks Robert, so basically what you are saying is that if you use that parameter, the output is rounded up to the nearest integer representation (in this case Gig) rather than displaying it as a fraction? For example, for a file that is 600 MB in size I would have expected the command to display it as 0.6G rather than 1G.
From the man page....
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g., '-BM' prints sizes in units of 1,048,576 bytes; see SIZE format below
and
The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (pow‐ ers of 1000)
Key word in the above definition of "SIZE" is "integer". And, as you've noted, 0.6 isn't an integer.
I just happen to have a computer in front of me. So, I can create a few files and try things.
[egreshko@meimei misty]$ ll test-dir/ total 1110004 -rw-rw-r--. 1 egreshko egreshko 1024000000 Mar 12 10:21 test -rw-rw-r--. 1 egreshko egreshko 102400000 Mar 12 10:27 test1 -rw-rw-r--. 1 egreshko egreshko 10240000 Mar 12 10:29 test2
[egreshko@meimei misty]$ ll -h test-dir/ total 1.1G -rw-rw-r--. 1 egreshko egreshko 977M Mar 12 10:21 test -rw-rw-r--. 1 egreshko egreshko 98M Mar 12 10:27 test1 -rw-rw-r--. 1 egreshko egreshko 9.8M Mar 12 10:29 test2
[egreshko@meimei misty]$ ll --si test-dir/ total 1.2G -rw-rw-r--. 1 egreshko egreshko 1.1G Mar 12 10:21 test -rw-rw-r--. 1 egreshko egreshko 103M Mar 12 10:27 test1 -rw-rw-r--. 1 egreshko egreshko 11M Mar 12 10:29 test2
[egreshko@meimei misty]$ du -s -BG test-dir/* 1G test-dir/test 1G test-dir/test1 1G test-dir/test2
[egreshko@meimei misty]$ du -s -BG test-dir 2G test-dir
[egreshko@meimei misty]$ du -s -BM test-dir/* 977M test-dir/test 98M test-dir/test1 10M test-dir/test2
[egreshko@meimei misty]$ du -s -BM test-dir 1084M test-dir
And, since there is a difference, the man page for "ls" should be consulted to find....
-h, --human-readable with -l and/or -s, print human readable sizes (e.g., 1K 234M 2G)
--si likewise, but use powers of 1000 not 1024
Thanks Ed, this functionality seems to be counter intuitive to me. Given that du shows space used in sub-directories, it seems to me the only useful output is du without any parameters.
regards,
Steve
users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org