[NTLUG:Discuss] total drive size
Bishop, Cass
cbishop at atxtelematics.com
Wed Mar 12 14:07:05 CST 2003
That's what I was looking for. Thanks for all the help.
Cass
-----Original Message-----
From: Fred James [mailto:fredjame at concentric.net]
Sent: Wednesday, March 12, 2003 1:46 PM
To: NTLUG Discussion List
Subject: Re: [NTLUG:Discuss] total drive size
MadHat wrote:
>On Wed, 2003-03-12 at 11:49, MadHat wrote:
>
>
>>On Wed, 2003-03-12 at 11:25, Rev. wRy wrote:
>>
>>
>>>Bishop, Cass wrote:
>>>
>>>
>>>
>>>>What I was hoping for is a command, or series of commands that can get
the
>>>>info for each partition then total it up for me. I have started with
this
>>>>to get a list of partition sizes but I'm not sure what to do with it
now. I
>>>>need to total this number and make it human readable(like the df -h
option).
>>>>
>>>>df|cut -c 20-29|grep -v block
>>>>
>>>>
>>ok, try this...
>>
>>$ for i in `df -k | grep "^/dev" | awk '{print $3}'`; do total=`dc -e
>>"$i $total + p" 2>/dev/null`; done; total=`dc -e "$total 1024 / p"`;
>>echo "total Mb used $total"
>>
>>Will print total Mb used on the computer
>>
>>It would be easier to script, but...
>>
>>
>
>better yet, just use awk (wasn't thinking before)
>df -k | grep "^/dev" | awk '{print Total+=$3 }' | tail -1 | awk '{print
>$1/1024, "Mb used"}'
>
>which works with SSH
>$ ssh dodo df -k | grep "^/dev" | awk '{print Total+=$3 }' | tail -1 |
>awk '{print $1/1024, "Mb used"}'
>4638.88 Mb used
>
>want to know free?
>$ ssh dodo df -k | grep "^/dev" | awk '{print Total+=$4 }' | tail -1 |
>awk '{print $1/1024, "Mb free"}'
>12722.4 Mb free
>
>
>
>
>
And if his orginal question was for the total of all space;
$ ssh dodo df -k | grep "^/dev" | awk '{print Total+=$2 }' | tail -1 |
awk '{print $1/1024, "Mb free"}'
will obviously do it.
--
"It's not nice to fool Mother OS." --anonymous
_______________________________________________
https://ntlug.org/mailman/listinfo/discuss
CONFIDENTIALITY NOTICE: The information in this e-mail is privileged and
confidential. Any use, copying or dissemination of any portion of this
e-mail by or to anyone other than the intended recipient(s) is unauthorized.
If you have received this e-mail in error, please reply to sender and delete
it from your system immediately.
More information about the Discuss
mailing list