Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

Possible Duplicate:
How to apply recursively chmod directories without affecting files?

What is the command to apply execute permission for directories (for traversal), but leave the execute bit off for files contained in the directory?

share|improve this question

marked as duplicate by Mat, Gilles, Mikel, Michael Mrozek Jun 2 '12 at 6:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 18 down vote accepted

If you don't want to remove the executable bit from existing files you can use the X mode. To recursively set the executable bit on all directories use:

chmod -R a+X dir

From man chmod:

execute/search only if the file is a directory or already has execute permission for some user (X)

share|improve this answer

You want to test this first (as I didn't):

find . -type d -exec chmod u+x {} \;

Find all directories, then add x-bit for the owner/user.

share|improve this answer
If I understand the chmod man page correctly, Ulrich's answer is the better one. – jippie May 31 '12 at 20:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.