The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Hardware > Filesystems, Disks and Memory
.
google unix.com




Thread: disk space
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 05-22-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,557
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.

Code:
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"
}'