Find a delete all the files owned by a user

Post Reply
a24uall
Site Admin
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

Find a delete all the files owned by a user

Post by a24uall »

Here we will see how to delete all the files owned by a user named "nivedha" from the /tmp folder
cd /tmp
find /tmp/ -type f -user nivedha | xargs rm -f
Arun
WebhostingDevelopment.com
a24uall
Site Admin
Posts: 166
Joined: Sun Jul 01, 2012 9:07 am

Re: Find a delete all the files owned by a user

Post by a24uall »

Another method is
cd /tmp

Code: Select all

for i in `find /tmp -user ncuysoog`; do rm -f $i; done
Arun
WebhostingDevelopment.com
Post Reply

Return to “Miscellaneous”