Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Please someone assist me with chmod, I have the following file structure


How do I chmod 655 to all files under dir1 and all subdir? So all files will have 655 permission and all dir will remain as they were.

Thank you

share|improve this question

2 Answers 2

up vote 34 down vote accepted

Better to use

find . -type f -exec chmod 655 {} +

The other proposed solution from @sagarchalise will not work if filenames contain spaces.

share|improve this answer
Relatedly, to chmod all directories you can use find . -type d -exec chmod 755 {} + to change all directories to 755. –  Kris Harper Aug 24 '11 at 13:02
this works, no pain :). Thanks! –  netic Aug 27 '11 at 2:37

I think going inside dir1 and

find . -type f | xargs chmod 655

will do the trick.

share|improve this answer
this works too but i've got some warning with "No such file or directory" –  netic Aug 27 '11 at 2:39
@manetic: it depends, as said in my answer, on filenames containing spaces. –  enzotib Aug 27 '11 at 5:51
For completeness, changing it to find . -type f -print0 | xargs -0 chmod 655 would fix the space issue I believe, although @enzotib's answer is more concise –  Disco 3 Aug 20 at 10:22

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.