2010/1/19 Paulo Jacob <paulo.jacob at gmail.com>:
> On 01/19/2010 07:29 PM, FRLinux wrote:
>> On Tue, Jan 19, 2010 at 7:05 PM, Walter Faleiro<curtorkar at gmail.com>
>> wrote:
Hi there,
>>> I have a command for calculating disk usage in a folder per usage basis
To answer the later questions: that's the bit you're missing -- disk
usage *per user*.
>>> find ./ -printf "%u %k/\n"| awk '{user[$1]+=$2}; END{ for( i in user)
>>> print i " " user[i]}'
It does the sums based on the file owner and 1 kB disk blocks.
>>> If I use %s it shows the usage as 2.7 e+09 etc hence am using %k.
>>>>>> I get the output as
>>> <user> <usage in kb>
>>>>>> what math can I apply to convert the usage to GB?
Divide by a million.
Or by 1024*1024, depending on how accurate you want to be.
Replace the final
user[i]
with
user[i]/1048576
(or, as Nexor said, 2^20)
Output will be printed according to CONVFMT, which defaults to "%.6g"
-- set that (for example, in the END block) to decide what rounding
and decimal places you want to see.
>> What's wrong with du -sh ? Or am i just completely missing the point here?
> I don't understand it either Steph. We both must be missing the point here.
It looks like a kind of advisory quota system, on shared writable space.
f
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!