On 16/09/10 23:34, Paul Eggert wrote: > On 09/16/10 11:21, Eric Blake wrote: >> document -m, with --block-size=M as the long-option spelling >> add -g, with --block-size=G as the long-option spelling > > This doesn't sound like a good idea. Multi-terabyte disks > are already here, and "df -t" is already taken. Also, > "df -g" already means something different in Solaris. > > Is it really that hard to type "df -Bg"?
Yes I agree the current unit selection options are fine. > If we're going to make incompatible changes, I suggest that > we solve the problem once and for all, by having "df" choose > the default blocksize dynamically, based on the size of the > output line describing the smallest disk. For example, where > "df" currently outputs this: > > Filesystem 1K-blocks Used Available Use% Mounted on > /dev/sda1 11620338002 1437021 11618900981 1% /r/opt > /dev/sda2 20971520 1335871 19635650 7% /home/eggert > > "df" would notice that the smallest file system is between 1GB and 1TB, > so it would default to 1 GB blocks, as follows: > > Filesystem 1GB-blocks Used Available Use% Mounted on > /dev/sda1 11900GB 2GB 11898GB 1% /r/opt > /dev/sda2 22GB 2GB 21GB 7% /home/eggert > > This is much more useful as an output format, because one can visually > see which file systems are larger by seeing how many digits are there. > Contrast this to the output of df --si: > > Filesystem Size Used Avail Use% Mounted on > /dev/sda1 12T 1.5G 12T 1% /r/opt > /dev/sda2 22G 1.4G 21G 7% /home/eggert > > which is harder to visually parse that way. That would break lots of scripts I'd say (they should use -P, but many don't). In any case I don't think there is enough benefit in such a format change given the common wide range of device sizes attached to systems. Personally I find the `df -h` format easiest to read. > While we're at it, we should fix "df" so that its columns line up better; > that would be another incompatible change, but it'd be worth it > on hosts where the file system names are long. We definitely should do this to support languages with side column headings, and `df -B\'1` I've an unfinished local branch to do this with mbsalign() cheers, Pádraig.