Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Help: Tracking disk usage with df...

Help: Tracking disk usage with df...
Thread Tools
Dedicated MacNNer
Join Date: Feb 2003
Status: Offline
Reply With Quote
Jul 11, 2003, 10:04 AM
 
Hi, second problem. Sorry to bother. Right now I'm using:
df -k | grep /dev/disk/*
To display current disk usage. The only problem is I'd rather only get the total in MB and/or % with disk name. I'm now getting even with the grep:

/dev/disk 24415936 6261288 17910492 25% /VolumeName


Any way to get:

Total MB % VolumeName

Thanks.
     
Forum Regular
Join Date: Feb 2000
Status: Offline
Reply With Quote
Jul 11, 2003, 05:48 PM
 
you might want to man du and sort

identify the large users that can safely have files removed from the respective directories and or the entire directory structure itself.

If it is a common temporary directory you may also wish to write a script (shell, python, perl, etc.) and possibly add it as a cron job...

HINT: du | sort -nr | head -XXX
(the head as you will invariably have a million small files that you probably don't want to remove anyways, but you may wish to omit that part. Also XXX is some number, which would depend on your typical output, but this is just Q&D.)
     
jgift  (op)
Dedicated MacNNer
Join Date: Feb 2003
Status: Offline
Reply With Quote
Jul 12, 2003, 01:18 AM
 
I had been looking at du... Will look again... Thanks.
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Jul 12, 2003, 11:58 AM
 
If you really want MB, a simple shell pipe would resolve it

Here's an awk-based solution, but almost any shell processor could handle it:

Code:
df -k | awk '/disk/ {print $4/1024, " " $5, " ", $6}'
Gods don't kill people - people with Gods kill people.
     
jgift  (op)
Dedicated MacNNer
Join Date: Feb 2003
Status: Offline
Reply With Quote
Jul 12, 2003, 12:18 PM
 
That works great... Almost there. Thanks! Any way to get a tab in between the fields?

ie now:

10855.2 14% /Volumes/Scratch
2626.3 3% /Volumes/Swap
115538 1% /Volumes/Multimedia
     
Dedicated MacNNer
Join Date: Jul 2001
Location: NC
Status: Offline
Reply With Quote
Jul 12, 2003, 03:44 PM
 
Originally posted by jgift:
That works great... Almost there. Thanks! Any way to get a tab in between the fields?
&nbsp;&nbsp;&nbsp;Yes, just put a tab in the quotes that now contain spaces. Of course, if you just hit the tab key, most shells will think you are asking for some sort of completion so you'll have to quote the tab by preceding the keystroke with <Command>-v.
Gary
A computer scientist is someone who, when told to "Go to Hell", sees the
"go to", rather than the destination, as harmful.
     
jgift  (op)
Dedicated MacNNer
Join Date: Feb 2003
Status: Offline
Reply With Quote
Jul 12, 2003, 05:20 PM
 
Got it working with some playing around... Thanks for all the help. happy camper here
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:05 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2