# find . -user user1 -type f -exec du -k {} \;
Explanation of this command:
The -user option allows you to specify that find will only report files that are owned by the specified user.
The -type option forces find to only return the path of items of a specific type (in this case, files). this prevents du from including directories, which might be owned by one user, but contain files for many users.
Then, for each found path, the du command is executed to report the disk usage.
To get summary information, i.e the total space used by a specific user:
# find . -user user1 -type f -exec du -k {} \;|awk '{ s = s+$1 } END { print "Total used: ",s }'
You use the same principle with groups using the -group option to find:
# find . -group dba -type f -exec du -k {} \;|awk '{ s = s+$1 } END { print "Total used: ",s }'
2 comments
Write commentsnice command but i need fasterly check is there any script please help me out i m provding my emaill id manju.hosmane@gmail.com i hope i ll get reply
ReplyManjunath,
ReplyYou can create a script with command in the article easily. Reach me in email, if you need help to create a script
What do you think about this Article? Add your Opinion..! EmoticonEmoticon