Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 49 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 – matt freake Aug 20 '15 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.