Change file permissions with chmod
Add or remove read, write, and execute permission for the owner, group, or others using symbolic or octal modes.
01Command
$ chmod u+x script.sh02What it does
Symbolic mode is 'who + operator + permission': u (owner), g (group), o (others), a (all) combined with +, -, or = and r, w, x — for example go-w removes write from group and others. Octal mode sets all bits at once: 755 = rwxr-xr-x (owner full, others read/execute), the usual choice for scripts and directories, while 644 is typical for data files. Use -R to recurse (chmod -R u+rwX dir gives X only where already warranted), and verify the result with ls -l or stat. x on a directory means 'may enter/traverse', not 'may run'.
03Risk
04Undo
$ chmod u-x script.sh05Sources
- chmod(1) — change file mode bitsEvidence: The chmod man page describes both symbolic modes like u+x (who operator permissions) and octal modes like 755 for setting mode bits.
Last verified: 2026-09-17 · Category: Files & Folders
06Related solutions
Find every occurrence of a pattern across all files in a tree, printed as file:line:number matches.
Unpack a gzipped tarball into the current directory while printing each file as it is extracted.
Generate a modern Ed25519 public/private key pair in ~/.ssh for authenticating to servers and Git platforms without passwords.