[Cialug] space by directory
Thomas Kula
kula at tproa.net
Wed Sep 5 13:59:08 CDT 2012
On Wed, Sep 05, 2012 at 01:51:48PM -0500, murraymckee at wellsfargo.com wrote:
> We're running Linux under IBM zVM and I have a problem. One of our mount points is running low on space. I can do "df -h" which tells me which mount point is short on space, but I can't seem to find a way to look at the directories under the mount point to figure out which one is using up more than its share of space.
>
> I hoping there is something that I can cd to the mount point and it will list the space used by all of the directories underneath it, recursively. I just want a list of the directories immediately below where I am, but with all the space used in that directory or any subdirectory under it.
>
> Is there anything like that?
Take a look at `du'. I tend to do something like:
cd /mountpoint
du -sxk * # The -s says "just sum up everything under each argument"
# The -x says "don't cross mountpoints" (useful if you have
# other mountpoints mounted under this mount point)
# The -k says "display in kilobytes"
Fancier du will have the -h option, which shows things in
"human readable" format (487 MB, 3.6GB, etc. ). Ancient
crufty du won't have either -s or -h. Consult your man
page.
For directories with lots of things, I tend to do:
du -sxk * | sort -k 1nr
To sort the output, largest to smallest. Throw a
'head' in there if you want to see the top N things.
As always, more info in the man pages.
--
Thomas L. Kula | kula at tproa.net | http://kula.tproa.net/
Mathom House by the Cloisters, The People's Republic of Ames
More information about the Cialug
mailing list