Operating System - HP-UX
1753488 Members
4499 Online
108794 Solutions
New Discussion юеВ

Script to report user storage

 
SOLVED
Go to solution
Coolmar
Esteemed Contributor

Script to report user storage

Hi,

Does anyone know of a script out there that will report (therefore probably a perl script) the amout of storage each user is taking up on the system? I am certain there would be something out there but I can't find anything.

Thanks!
6 REPLIES 6
RAC_1
Honored Contributor

Re: Script to report user storage

This becomes quite is easy, if you have implemented quotas on your system, else, you will have to find files/dirs owned by users and then calculate space used.-this is going to be cpu consuming task.

Anil
There is no substitute to HARDWORK
Rick Garland
Honored Contributor

Re: Script to report user storage

If you are looking at just the home dirs,

# cd /home
# du . -ka | sort -nr | more

The will report file sizes and sort into ascending order (biggexst to smallest)

Coolmar
Esteemed Contributor

Re: Script to report user storage

No, I want more than "home" and I want output in the form of a report:

UserID Space Used

xxxxx 3456000Kb

That type of thing. I do not have quotas. I have seen something that does this nicely in the past, but just can't find it.

Thanks for the responses
RAC_1
Honored Contributor
Solution

Re: Script to report user storage

Something as follows.

ll -R /FS | grep user1 | awk '{size+=$5} END {printf "%d\n", "user", size}'

you can use find, but be carefull this can hog CPU.

find /FS_to_search -user user1 -exec ll -d {} \; | awk '{size+=$5} END {printf "%d\n", "user", size}'
There is no substitute to HARDWORK
Rick Garland
Honored Contributor

Re: Script to report user storage

No such script exists by default. This would need to be created.


Alex Lavrov.
Honored Contributor

Re: Script to report user storage

Without quotas, you'll have to search for all user's files in the system. Implementing quotas in your system will be the erfect solution.
I don't give a damn for a man that can only spell a word one way. (M. Twain)