chmod—change the permissions mode of a file

chmod [-Rcfv] [--recursive] [--changes] [--silent]
      [--quiet] [--verbose] [--help] [--version] mode file…

chmod changes or assigns the mode of a file. The mode of a file specifies its permissions and other attributes. The mode may be absolute or symbolic.

Example A.10.
1    chmod +x script.file
2    chmod u+x,g-x file
3    chmod 755 *
				

Explanation

  1. Turns on execute permission for user, group, and others on script.file.

  2. Turns on execute permission for user, and removes it from group on file.

  3. Turns on read, write, and execute for the user, read and execute for the group, and read and execute for others on all files in the current working directory. The value is octal ( 111 101 101 ), rwxr-xr-x.

Get Linux Shells by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.