Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Can anyone please tell how can I change files/directories owned by me only.

below is the command that list out files/directories owned by me

 find . -user <username>
share|improve this question

1 Answer 1

up vote 1 down vote accepted

If your find already supports -exec {} +:

find . -user "$username" -exec chmod ... {} +

If it at least supports -print0 and your xargs supports -0:

find . -user "$username" -print0 | xargs -0 chmod ...

Or if there are no newlines in the file paths:

find . -user "$username" | xargs -d '\n' chmod ...
share|improve this answer
    
-exec ... {} + is standard and POSIX, the other ones are not. -0 is GNU and supported by a few others (like most recent BSDs, not AIX), -d is GNU only. All find implementations support -exec ... {} ';' –  Stéphane Chazelas Feb 12 at 16:32

Your Answer

 
discard

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.