disk space

Hello All-

Am new member to this forum. Have some unix experience. But true believer in it compared to windows.
Have a question regarding the disk space.

I know a command to check the total disk space utilization using:
df -k .

but what is the command to check the same disk space by user. How much each of the user is using the disk space.

There is no simple command to do what you need.

If people are using ridiculous amounts of disk space, instead of trying to police it yourself, enable disk quotas. If you tell us what you need someone here can help you put together a script.

this will not calc how much space is allocated to user, however it finds total size of files owned by user and totals them up.

awk 'BEGIN{
 path="/"
 user="root"
 total=0
 cmd="find "path" -type f -user "user" -printf \"%s\\n\""
 while (( cmd |getline line) >0){ total+=line }
 close(cmd)
 print "total size by user: "user" is: "total" bytes"
}' 

No, I don't want the files sizes, am basically looking for the total disk space usage by a user.

If I give a username, I should be able to find how much he or she is using.

I have done this before, but don't remember the command now.

Are you looking for the "du" command ?

That's right, am looking for du command that gives the disk usage by user.

-----Post Update-----

How do I run this?? Am only aware of unix commands.

Thanks

-----Post Update-----

How do I run this?? Am only aware of unix commands.

Thanks

If you run du on a directory, it will give you the size of that directory, not the disk space used by a user, eg. it won't count the files created by that user in /tmp, /var/tmp or other locations, and it will add files in the directory not owned by that user.

If you want the total size of files owned by a user, use ghostdogs command above.