exa icon indicating copy to clipboard operation
exa copied to clipboard

Document file size rounding logic

Open ariasuni opened this issue 3 years ago • 4 comments

I took a look at GNU coreutils docs: https://www.gnu.org/software/coreutils/manual/html_node/Block-size.html#Block-size

Fractional block counts are rounded up to the nearest integer. ... The -h or --human-readable option is equivalent to --block-size=human-readable. The --si option is equivalent to --block-size=si.

I would recommend documenting exa's choice whether it decides to keep current logic of traditional rounding, or if it adopts ls choice of rounding up to whole block.

https://github.com/ogham/exa/issues/812#issuecomment-808772385

ariasuni avatar Apr 09 '21 17:04 ariasuni

I was also confused by this, I was expecting exa to be a mostly drop-in replacement for ls but was confused by the differing filesizes listed between two terminal tabs, one using exa while the other using ls.

As suggested, adding --binary to my alias resolves the issue, I expected this to be the default rather than an opt-in.

missinglink avatar Feb 08 '22 22:02 missinglink

Worth noting that my file now shows as 779M with ls and as 778Mi with exa, so it's still not exactly the same rounding logic.

The stat command for this file returns 816709632

missinglink avatar Feb 08 '22 22:02 missinglink

+1 for "As suggested, adding --binary to my alias resolves the issue, I expected this to be the default rather than an opt-in."

sisrfeng avatar Nov 30 '22 08:11 sisrfeng

I've added an option to display binary units to my wrapper script, so that listings can appear to be even more like ls.

https://gist.github.com/eggbean/74db77c4f6404dd1f975bd6f048b86f8

eggbean avatar Dec 01 '22 23:12 eggbean