chmod +x
Adds execute permission, so a script or program can be run directly.
chmod +x file turns on the execute bit. With no u, g or o in front, chmod adds it for the owner, the group and everyone else — except where your umask masks it out.
It adds a bit and changes nothing else, which is why it's safer than reaching for a number like 755.
What it changes
-rw-r--r-- (644)-rwxr-xr-x (755)with the usual umask of 022
Examples
chmod +x deploy.sh && ./deploy.sh
make a script executable, then run it
chmod u+x deploy.sh
execute for the owner only
chmod a+x deploy.sh
execute for everyone, regardless of umask
git update-index --chmod=+x deploy.sh
record the executable bit in Git — needed when committing from Windows
Good to know
- A script also needs a shebang line such as
#!/usr/bin/env bashas its first line; without one, the shell decides how to run it. - On a filesystem mounted
noexec(often/tmpor a USB drive), execution fails with "Permission denied" even afterchmod +x. Run it through the interpreter instead:bash script.sh. - Windows drives under WSL (
/mnt/c) ignore chmod unless they're mounted with themetadataoption. - Only the file's owner (or root) can change its mode; anyone else gets "Operation not permitted".
Frequently asked questions
What is the difference between chmod +x and chmod 755?
chmod +x adds the execute bit and keeps everything else as it was. chmod 755 sets the whole mode to rwxr-xr-x, discarding whatever was there. On a typical 644 file the result is the same.
What is the difference between chmod +x and chmod u+x?
u+x gives execute permission to the owner only. +x with no class adds it for owner, group and others, minus any bits your umask masks — so with umask 077 it behaves like u+x.
Why do I still get Permission denied after chmod +x?
Usually the filesystem is mounted noexec, or a directory on the path lacks execute (search) permission for you. A missing or wrong interpreter gives "bad interpreter" or "No such file or directory" instead.