breakitdown

chmod X (capital X)

Answer

A capital X in a chmod operation adds execute permission only to directories and to files that already have execute set for someone. Ordinary data files are left non-executable, which makes X the safe choice with chmod -R.

chmod a+X on common starting modes

Computed with the umask at 022, the usual default. Checked against GNU chmod on real files.

BeforeTypeAfter
644file644 rw-r--r--
600file600 rw-------
755directory755 rwxr-xr-x
700directory711 rwx--x--x

What to know

chmod -R a+X dir makes every directory in the tree enterable without marking every data file executable: a 644 file stays 644, a 644 directory becomes 755, and a 700 script becomes 711.

The common recipe for a web or project tree is chmod -R u=rwX,go=rX dir. Directories end up 755, plain files 644, and files that were already executable 755.

Where it fits

Gotchas

Related explainers

← chmod calculator