Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 6
    If your find supports it, use -exec ... \+ instead of -exec ... \; — it'll require fewer fork+execs. If it doesn't, use find ... -print0 | xargs -0 .... Commented Jun 8, 2012 at 19:49
  • 5
    I've used this technique, but with "-perm +111" added to the find so it only chmod's ones that have the x-bit set: find . -type f -perm +111 -exec chmod -x {} \; Commented May 28, 2013 at 12:54
  • 5
    +1 @Matthijs The reason why this is better than pabouk's solution is that this command leaves directories alone, while pabouk's re-sets the executable bit in all directories. There might be some directories which have the executable bit not set, and pabouk's command sets it, while one might wish to leave them as they are. Commented Nov 9, 2013 at 11:14
  • the 2nd approach will fail for paths that contain spaces. Commented Sep 16, 2015 at 18:50
  • @ephemient: if your find supports -print0 I'm pretty sure it will also support -exec Commented Sep 16, 2015 at 18:52