Take the 2-minute tour ×

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 22 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

Your Answer


