Hello All,
Actually I need check all files & different user ID files contain one directory.
How to check total files with as per User ID with total usage in current directory command.
example :
File system path in Linux Operating Systems:
/tmp/example/
above mentioned path , example directory consuming 20 GB files , actually I need to find which user ID containing total memory details required.
please provide me command to check multiple users ID Total usage details in directory .
once executed command then get output with as per users ID total utilization status required in current directory.
I hope explained my query.
could you please check and provide command.
I am waiting for your valuable information.
Thanks & Regards,
Jeesshnasree
Hello jeesshnasree,
You can do this with find and awk. First use find to get a list of unique user names for the files contained in the directory. Then use find -user ${username} -ls and awk to sum up the total size for all the files owned by that user.
Something like:
for user in `find . -type f -ls | awk '{ print $5}' | sort | uniq`
do
usage=`find . -type f -user $user -ls | awk '{total+=$7}; END{ print total}'`
echo "Usage for user $user: $usage bytes"
done
Hello jeesshnasree,
You can do this with find and awk. First use find to get a list of unique user names for the files contained in the directory. Then use find -user ${username} -ls and awk to sum up the total size for all the files owned by that user.
Something like:
for user in `find . -type f -ls | awk '{ print $5}' | sort | uniq`
do
usage=`find . -type f -user $user -ls | awk '{total+=$7}; END{ print total}'`
echo "Usage for user $user: $usage bytes"
done
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.