New option for ls(1), du(1), df(1)

Bakul Shah bakul at bitblocks.com
Fri Nov 24 10:42:59 PST 2006


Oliver Fromme writes:
...
> I've hacked a new option into those tools which uses
> thousands separators for displaying the numbers.  With
> that option, the output looks like this (in US locale):
> 
> Filesystem    1K-blocks      Used       Avail Capacity  Mounted on
> /dev/ad0s1a   1,012,974    62,418     869,520     7%    /
> /dev/ad0s1d  10,154,158    31,474   9,310,352     0%    /var
> /dev/ad0s1e  10,154,158 1,545,718   7,796,108    17%    /usr
> /dev/ad0s1f 128,009,212 1,358,600 116,409,876     1%    /home
> /dev/md0        297,326        20     273,520     0%    /tmp

...

Rather than add more code to quite a few programs I just use
a separate program since this is useful in many places.

$ df | hunit
Filesystem      1K-blocks     Used   Avail Capacity  Mounted on
/dev/ad0s3a         99,183    66,198   25,051    73%    /
devfs                   1        1       0   100%    /dev
/dev/ad0s3e        190,167    29,468  145,486    17%    /var
/dev/ad0s3f      61,147,922 54,629,382 1,626,708    97%    /usr

Granted, columns don't line up right but that too belongs in
a separate program.

> It is also worth noting that probably many more tools
> might benefit from that feature.  "netstat -i" and
> "ipfw show" come to mind immediately.

Which is why a separate program is nicer.


More information about the freebsd-arch mailing list