Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a way to recursively find all files owned by a user and change them to another user/group in Gnu/Linux?

I assume there must be some magic one liner but my command line wizardry skills are not up to that :)


share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

Use the find command with the -user option. Something like:

find / -user john

will eventually turn up all files owned by user "john".

If you want to change their ownership (I would run the find without execution to make sure you have the list you want), then something like:

find / -user john -exec chown harry {} \;

will do it.

share|improve this answer
I usually use UID and run chown harry:harry if I need to make sure the group membership is right, too. But that depends heavily on the application here. –  ewwhite Apr 9 '12 at 21:58
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.