Subject: Re: bin/2893: Prettier df listings with long nfs mounts.
To: None <netbsd-bugs@NetBSD.ORG>
From: Arne H. Juul <>
List: netbsd-bugs
Date: 10/29/1996 10:57:16
Lots of things has been said in this thread so I'll just respond to
one point...

 > From: Christian Kuhtz <>
 > Date: Sat, 26 Oct 96 16:05:27 -0600
 > Hmpf.  I don't like the idea of beautifying by default.  That means  
 > that all scripts have to be modified that rely on single row output  
 > etc etc etc.  And besides, once we kick this snowball off, where  
 > does it stop?
 > I'm inclined to say "Ugly by default, add a flag to specify  
 > beautified output".
 > I'd rather have a user who cannot stand UNIX's uglyness to set an  
 > environment variable of some sort if that's what they want.  Or, a  
 > la 'ls', make them explicitly force beautification.  Have them alias  
 > their df if that's what they want.
 > Leave it as it is, or add an explicit option to change the default  
 > behavior.  Or, let's see, does POSIX address this issue?  If so,  
 > let's go with whatever POSIX says.

I think Posix.2 says it, but I only have the Single Unix Specification:

The format of the default output from df is unspecified, but all space
figures will be reported in 512-byte units, unless the k option is

The following options are supported:
 -P  Produce output in the format described in STDOUT. 
[... -k and extension -t for "total"...]

When both the -k and -P options are specified, the following header
line will be written (in the POSIX locale):
"Filesystem 1024-blocks Used Available Capacity Mounted on\n"

When the -P option is specified without the -k option, the following header
line will be written (in the POSIX locale):
"Filesystem 512-blocks Used Available Capacity Mounted on\n"

The implementation may adjust the spacing of the header line and the
individual data lines so that the information is presented in orderly
columns.  The remaining output with -P will consist of one line of
information for each specified file system. These lines are formatted
as follows:

"%s %d %d %d %d%% %s\n", <file system name>, <total space>, <space used>,
                         <space free>, <percentage used>, <file system root>

So it looks like "pretty by default, Posix (parseable) with -P".

 > Why does an OS have to be pretty?  It's not like a beautified df  
 > makes the OS run better ;-).

On "my" machines (netbsd,freebd,whatever):

$ type df
df is /store/gnu/bin/df

and why? partly because:

skarven:~$ /bin/df
Filesystem                       512-blocks     Used    Avail Capacity  Mounted on
/dev/sd0a                            107607    30902    73477    30%    /
mfs:18                                58014     1518    51856     3%    /tmp
/dev/sd0e                            107607    13400    90979    13%    /var
/dev/sd0f                             93583     7000    83776     8%    /store
/dev/sd0g                           1314878   902852   372580    71%    /usr
/dev/sd1a                           3099134  2288856   717304    76%    /usr/ms160
/dev/sd1e                            546612   344174   186040    65%    /usr/netbsd
/dev/sd2a                           8351414  6794502  1306370    84%    /export/ftpsearch1
/dev/sd3a                           8351414  6767286  1333586    84%    /export/ftpsearch2
/dev/sd4a                           8331370  6553318  1528112    81%    /export/ftpsearch3
procfs                                    8        8        0   100%    /proc
amd:112                                   0        0        0   100%    /net
amd:112                                   0        0        0   100%    /home
amd:112                                   0        0        0   100%    /stores   16632378 15455074  1010982    94%    /amd/

It's not exactly readable...

  -  Arne H. J.