As I've been working with "df --o" for quite a while now, I noticed that the readability of the full output could be improved by moving the inodes fields before the block fields: * inodes consumption is usually not often so critical in real life, * some file systems do not provide inodes information.
Before: $ src/df --o -h / /home . Filesystem Type Size Used Avail Use% Inodes IUsed IFree IUse% Mounted on /dev/sda1 ext4 12G 8.1G 2.9G 74% 751K 254K 497K 34% / /dev/sdb3 ext3 99G 61G 34G 65% 6.3M 81K 6.2M 2% /home /dev/sdb5 ext4 339G 255G 83G 76% 22M 1.1M 21M 5% /media/sdb5 After: $ src/df --o -h / /home . Filesystem Type Inodes IUsed IFree IUse% Size Used Avail Use% Mounted on /dev/sda1 ext4 751K 254K 497K 34% 12G 8.1G 2.9G 74% / /dev/sdb3 ext3 6.3M 81K 6.2M 2% 99G 61G 34G 65% /home /dev/sdb5 ext4 22M 1.1M 21M 5% 339G 255G 83G 76% /media/sdb5 WDYT? Have a nice day, Berny >From 7de2cd9f03971de8eb85c36f15f536bae033b9e5 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker <[email protected]> Date: Thu, 22 Nov 2012 14:24:42 +0100 Subject: [PATCH] df: reorder default field list of --output option As the inodes information is usually not so much of interest, and some file systems including btrfs do not even provide it, reading of the full df --output is easier when the block statistic fields come just left of the last field, the mount point. * src/df.c (all_args_string): Move the inodes fields before the block fields. (usage): Likewise. * tests/df/df-output.sh: Likewise. * doc/coreutils.texi (df invocation): Likewise. --- doc/coreutils.texi | 18 +++++++++--------- src/df.c | 8 ++++---- tests/df/df-output.sh | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 70e7ca0..53f7b58 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -10704,15 +10704,6 @@ The source of the mount point, usually a device. @item fstype File system type. -@item size -Total number of blocks. -@item used -Number of used blocks. -@item avail -Number of available blocks. -@item pcent -Percentage of @var{used} divided by @var{size}. - @item itotal Total number of inodes. @item iused @@ -10722,6 +10713,15 @@ Number of available inodes. @item ipcent Percentage of @var{iused} divided by @var{itotal}. +@item size +Total number of blocks. +@item used +Number of used blocks. +@item avail +Number of available blocks. +@item pcent +Percentage of @var{used} divided by @var{size}. + @item target The mount point. @end table diff --git a/src/df.c b/src/df.c index c62d16b..cac26b7 100644 --- a/src/df.c +++ b/src/df.c @@ -193,8 +193,8 @@ static struct field_data_t field_data[] = { "target", OTHER_FLD, N_("Mounted on"), 0, MBS_ALIGN_LEFT, false } }; -static char const *all_args_string = "source,fstype,size,used,avail,pcent," - "itotal,iused,iavail,ipcent,target"; +static char const *all_args_string = + "source,fstype,itotal,iused,iavail,ipcent,size,used,avail,pcent,target"; /* Storage for the definition of output columns. */ static struct field_data_t **columns; @@ -1164,8 +1164,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ emit_size_note (); fputs (_("\n\ FIELD_LIST is a comma-separated list of columns to be included. Valid\n\ -field names are: 'source', 'fstype', 'size', 'used', 'avail', 'pcent',\n\ -'itotal', 'iused', 'iavail', 'ipcent' and 'target' (see info page).\n\ +field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent',\n\ +'size', 'used', 'avail', 'pcent' and 'target' (see info page).\n\ "), stdout); emit_ancillary_info (); } diff --git a/tests/df/df-output.sh b/tests/df/df-output.sh index f586334..960d30e 100644 --- a/tests/df/df-output.sh +++ b/tests/df/df-output.sh @@ -67,11 +67,11 @@ compare exp out || fail=1 # that --o (without argument) is identical to the full list. cat <<\EOF > exp || framework_failure_ -Filesystem Type Size Used Avail Use% Inodes IUsed IFree IUse% Mounted on +Filesystem Type Inodes IUsed IFree IUse% Size Used Avail Use% Mounted on EOF -df -h --o=source,fstype,size,used,avail,pcent \ - --o=itotal,iused,iavail,ipcent,target '.' >out || fail=1 +df -h --o=source,fstype,itotal,iused,iavail,ipcent \ + --o=size,used,avail,pcent,target '.' >out || fail=1 sed -e '1 { s/ [ ]*/ /g q -- 1.7.7
