Re: [PATCH] Support for thresholds in du(1)



On (04/02/2010 23:24), jhell wrote:

On Thu, 4 Feb 2010 06:55, gleb.kurtsou@ wrote:
On (25/02/2009 17:24), Mel wrote:
Hi,

attached is a small patch to add threshold support to du(1). I've been using
it on 7-STABLE machines for a while, cause I got tired of the noise I get
when sorting and then reformatting to human-readable. Especially since
sorting isn't part of the equasion "I'd like to see all dirs exceeding a
given size".
I've not updated the manpage on -STABLE yet, should be the same as HEAD.

Example usage:
# du -xht 20m .
29M ./contrib/binutils
52M ./contrib/gcc
237M ./contrib
35M ./crypto
28M ./lib
20M ./share
55M ./sys/dev
139M ./sys
545M .

I'll file a PR for it, if there's no objections to this feature /
implementation, the style(9) or the usage of -t.
--
Mel

Hi,

I've cleaned up original patch:
* fixed style and some bugs
* as suggested changed it to use expand_number
* implemented support for negative threshold values

I find the patch very useful. Does it look ok to be commited, or should
I file a PR so it won't get lost once again.

Example usage:
src/sys/crypto % du -ht 100k
137K ./des
482K .
src/sys/crypto % du -A -ht +100k
129K ./des
446K .
src/sys/crypto % du -ht -100k
56K ./camellia
11K ./salsa20
38K ./sha2
9.0K ./rc4
68K ./des/arch/i386
70K ./des/arch
88K ./rijndael
37K ./via
8.0K ./hmac
36K ./blowfish/arch/i386
37K ./blowfish/arch
85K ./blowfish



Also not to be picky but I can see this being raised in another email at a
later time.

For Each
du -ht +1.5{M,G,T,P}

Would be something nice to compliment this so you do not have to revert
back to say "1440k" when wanting to say 1.5m and so on for larger sizes.

Also I think to be fully supportive it should have the capability to do at
the least -N bits & +-N bytes.
Let's keep it simple, these features are are not hard to implement, but
overcomplicate such simple utility as du(1). If one needs more
sophisticated disk usage reporting he's likely to have 3rd party utils
installed already.

Thanks for the work that you have done on this.

--

jhell

_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"