[issue845] df() shell function

Michael Prokop bts at bts.grml.org
Mon Apr 26 18:26:38 CEST 2010


Michael Prokop <mika at grml.org> added the comment:

* Andras Korn wrote in grml's BTS on 20100423 / 18:27:

> please consider including this in your zshrc:

> function df() {
> 	/bin/df -a --portability "$@" | column -t | sed
> 's/Mounted[[:space:]]*on/Mounted on/'
> }

> This makes df output a lot more readable by making sure that all information for
> each filesystem is on a single line and still nicely tabulated.

> Observe the difference between the old and new behaviour:
[...]

> Including the -a (which causes "dummy" filesystems to be included) is useful
> especially for chroots and vservers with bind mounted filesystems; if /etc/mtab
> includes an entry where the device doesn't exist, df will by default skip that
> entry in the output, which is the wrong thing to do for bind mounts. I don't
> think there are so many actual dummy filesystems that their inclusion would
> seriously clutter the output of df.

> Placing this function in zshrc would ensure that it's only loaded for
> interactive shells; thus it wouldn't interfere with scripts that attempt to
> parse the output of df(1).

I like the idea but don't think changing behaviour of traditional
UNIX commands is a good idea. Though I'd ACK this function under a
different name, suggestions welcome. :)

regards,
-mika-

----------
messages: 3151, 3154
nosy: korn
priority: wish
status: chatting
title: df() shell function
topic: zsh

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue845>
_____________________________________


More information about the Bugs-changes mailing list