chmod
Change file mode bits (permissions)
Overview
Changes the file mode bits of each given file according to mode, which can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the new mode bits.
Syntax
chmod [OPTION]... MODE[,MODE]... FILE...
chmod [OPTION]... OCTAL-MODE FILE...
chmod [OPTION]... --reference=RFILE FILE...Common Options
-R, --recursiveChange files and directories recursively.
-v, --verboseOutput a diagnostic for every file processed.
-c, --changesLike verbose but report only when a change is made.
--reference=RFILEUse RFILE's mode instead of MODE values.
--silent, --quietSuppress most error messages.
Symbolic Modes: u (user), g (group), o (others), a (all)Classes for symbolic mode.
Symbolic Operators: + (add), - (remove), = (set exactly)Operators for symbolic mode.
Symbolic Permissions: r (read), w (write), x (execute), X (special execute), s (setuid/gid), t (sticky)Permissions for symbolic mode.
Examples
Makes script.sh executable by the user/owner.
Sets read/write/execute for user, and read/execute for group and others (octal).
Removes write permission for the group and others from important_data.
Sets read-only permission for everyone (user, group, and others).
Recursively sets read/write for user, and read-only for group and others for all files/directories in project_dir/.
Copies permissions from template.sh to new_script.sh.
Sets user to read, write, execute; group to read, execute; others to read, execute.