bug#10915: 8.13: df -- overly long output lines are very hard to read
On 03/01/2012 10:56 AM, Voelker, Bernhard wrote: > Jim Meyering wrote: >> jaalto wrote: > >> | > -r, --reverse >> | > >> | > $ df -Hlr >> | > >> | > Size Used Avail Use% Mounted-on Filesystem >> | > 6.0G 4.1G 1.7G 72% / rootfs >> | > 192M 0 192M 0% /dev udev >> | > 40M 1.5M 38M 4% /run tmpfs >> | > 6.0G 4.1G 1.7G 72% / >> /dev/disk/by-uuid/492764a5-7506-4489-8fd0-82d0d284d627 >> | > 5.3M 0 5.3M 0% /run/lock tmpfs >> | > 79M 7.9M 71M 10% /tmp tmpfs >> | > 79M 0 79M 0% /run/shm tmpfs >> | > 6.0G 4.1G 1.7G 72% /srv/cante.src >> /dev/disk/by-uuid/492764a5-7506-4489-8fd0-82d0d284d627 >> | > 6.0G 4.1G 1.7G 72% /srv/cante.tmp >> /dev/disk/by-uuid/492764a5-7506-4489-8fd0-82d0d284d627 >> | > 18G 8.1G 8.3G 50% /mnt/extent /dev/sdb1 >> | > 18G 8.1G 8.3G 50% /usr/src /dev/sdb1 >> | > 18G 8.1G 8.3G 50% /root/vc /dev/sdb1 > >> I agree that your --reverse (but without the short-named '-r') would >> be a useful improvement, regardless. That sounds reasonable for 8.16 >> is someone writes the patch. Even without the -r, you could still >> abbreviate the long name to "--r". > > What about a more general --fmt (or --format) option to > just get the columns you want in the order you want? > E.g. > > df --format=size,free%,mnt,fs > or > df --format=size-h,mnt # -h or > df --format=Size,mnt# uppercase Size meaning -h This is a border line feature, but I'm 60:40 for implementing it. Note something similar I noticed is: findmnt -l -o FSTYPE,SOURCE,TARGET It would make sense to align as closely to that as possible. So a full --output list supported by df could be FSTYPE,SOURCE,TARGET,SIZE,USED,AVAIL,FREEPCT It's probably sufficient to use this to just order fields, and leave other formatting to existing modifiers. cheers, Pádraig.
bug#10915: 8.13: df -- overly long output lines are very hard to read
On 07/26/2012 04:23 PM, Pádraig Brady wrote: > On 03/01/2012 10:56 AM, Voelker, Bernhard wrote: >> >> What about a more general --fmt (or --format) option to >> just get the columns you want in the order you want? >> E.g. >> >> df --format=size,free%,mnt,fs >> or >> df --format=size-h,mnt # -h or >> df --format=Size,mnt# uppercase Size meaning -h > > This is a border line feature, but I'm 60:40 for implementing it. > > Note something similar I noticed is: > > findmnt -l -o FSTYPE,SOURCE,TARGET > > It would make sense to align as closely to that as possible. > So a full --output list supported by df could be > FSTYPE,SOURCE,TARGET,SIZE,USED,AVAIL,FREEPCT > > It's probably sufficient to use this to just order fields, > and leave other formatting to existing modifiers. Implementing --output= is of course much simpler than what Jim proposed [1]: he suggested a stat-like --format option which takes %-directives. That would be much more flexible for the user, and the existing output formats would just be a pre-defined format strings. We could for the first time have blocks and inodes statistics in one command: %i inodes %I inodes in percent %a AVAIL %A AVAIL in percent %u unused %U unused percentage %t total size %T FSTYPE %s SOURCE %m TARGET (mount point) ... df --format="%u:%i:%T:%m" And some directives could have mixed SIZE modifiers, e.g. %{SIZE}u used blocks with SIZE like KMGTPEZY. %{SIZE}i inode number df --format="%Tt %Gu %Ki %m" Scripts could parse the output of --format (or --printf) much safer (SOURCE and TARGET can include almost any characters like '\n', '\t', etc. but never e.g. NULL) df --printf="%U\0%s\0%m\0\n" As already said, this would be a greater change in df.c, but some code could surely be shared with stat.c and maybe in future with "ls --format=..." ;-) I'm not against --output, but the advantage of a more flexible --printf is unbeatable IMO. Have a nice day, Berny [1] http://lists.gnu.org/archive/html/bug-coreutils/2012-03/msg7.html
bug#10915: 8.13: df -- overly long output lines are very hard to read
On 07/26/2012 04:43 PM, Bernhard Voelker wrote: > On 07/26/2012 04:23 PM, Pádraig Brady wrote: >> On 03/01/2012 10:56 AM, Voelker, Bernhard wrote: >>> >>> What about a more general --fmt (or --format) option to >>> just get the columns you want in the order you want? >>> E.g. >>> >>> df --format=size,free%,mnt,fs >>> or >>> df --format=size-h,mnt # -h or >>> df --format=Size,mnt# uppercase Size meaning -h >> >> This is a border line feature, but I'm 60:40 for implementing it. >> >> Note something similar I noticed is: >> >> findmnt -l -o FSTYPE,SOURCE,TARGET >> >> It would make sense to align as closely to that as possible. >> So a full --output list supported by df could be >> FSTYPE,SOURCE,TARGET,SIZE,USED,AVAIL,FREEPCT Oh right the last 4 items above should also have I... variants to cater for inodes. >> It's probably sufficient to use this to just order fields, >> and leave other formatting to existing modifiers. > > Implementing --output= is of course much simpler > than what Jim proposed [1]: > he suggested a stat-like --format option which takes %-directives. > > That would be much more flexible for the user, and the existing > output formats would just be a pre-defined format strings. > We could for the first time have blocks and inodes statistics > in one command: Good point, but that could be allowed too with --output > > %i inodes > %I inodes in percent > %a AVAIL > %A AVAIL in percent > %u unused > %U unused percentage > %t total size > %T FSTYPE > %s SOURCE > %m TARGET (mount point) > ... > > df --format="%u:%i:%T:%m" > > And some directives could have mixed SIZE modifiers, e.g. > > %{SIZE}uused blocks with SIZE like KMGTPEZY. > %{SIZE}i inode number > > df --format="%Tt %Gu %Ki %m" T overlaps, but I see what you mean. > Scripts could parse the output of --format (or --printf) much > safer (SOURCE and TARGET can include almost any characters like > '\n', '\t', etc. but never e.g. NULL) They can't actually. mbsalign replaced non printable chars in all but the last field, and there was a patch last week to replace control chars in the last field with '?' Would you still want to apply mbsalign to all fields but the last when using a specific format like this? > df --printf="%U\0%s\0%m\0\n" > > As already said, this would be a greater change in df.c, > but some code could surely be shared with stat.c and maybe > in future with "ls --format=..." ;-) > > I'm not against --output, but the advantage of a more > flexible --printf is unbeatable IMO. 60:40 for --output as ordering/selection is needed by some 40:60 against --printf as detailed formatting is neede by few cheers, Pádraig.