The usual ls
command can display the size of files with the option -h
and I am having a little doubt about it being display in MB or MIB.
For example :
$ ls -lha
drwxr-xr-x 2 user group 4.0K Apr 2 21:49 .
drwxr-xr-x 5 user group 4.0K Apr 2 21:49 ..
-rw-r--r-- 1 user group 129M Apr 2 21:49 2018-04-02T21:49:08.981976.hdf5
So, this leaves me with 2 questions :
- Does
ls -lha
displayed the size in MB or MiB? - Is it consistent across Unix-based operating systems and their own versions over time?
N.B.: Not only commercial Unix-based operating systems should be considered for this question.
-h
is portable (it isn't), then please [edit] your question to reflect that. Editing will also put it into the reopen review queue. – terdon Apr 04 '18 at 09:47--si
option as if that were a universal, and it speaking of "the"ls
manual (a familiar turn of phrase). Two non-GNUls
programs with-h
options, completely unaddressed by answers here or there, have already been mentioned in comments on this very page. – JdeBP Apr 04 '18 at 19:23-h
flag does in GNUls
, which actually has it, has been adequately answered by the dupe. I don't know how thesels
you mention should be "addressed", we can't give a list of allls
implementations, that would be off topic. Paradox, again, please edit your question and clarify what you're asking. The-h
option is not standard so yes, it can behave differently or be absent or do something completely different if the authors of an implementation choose it. – terdon Apr 05 '18 at 08:18ls
implementations that exist apart from the GNU one is off-topic? I strongly dispute that. This is Unix and Linux Stack Exchange, not GNU Stack Exchange. – JdeBP Apr 05 '18 at 19:12ls
in the *nix world. If Paradox would only edit the question to make it ask something that is specific and answerable about the portability of-h
, then it would absolutely be on topic. But asking for the existence and behavior of the-h
flag on everyls
in existence is just too broad for this site. – terdon Apr 06 '18 at 10:24