Change access permissions (mode)
(mode of a new file is set based on the umask )

chmod [Options]… symbolic-mode file
chmod [Options]… mmm file

--reference=reffile use reffile's mode

-R, --recursive
-f, --silent, --quiet suppress most error messages
-v, --verbose show files processed
-c, --changes show files changed

[ugoa] [+-=][rwx Xst]
ugoa specifies which users' access to the file will be changed:
  user who owns it
  Other users in the file's group
  other users i.e. not the user who owns it and not users in the file's group
  all users ( i.e. ugo)
Default is a but bits that are set in the umask are not affected.

+ adds to the existing modes ,
- removes modes, and
= sets modes

rwx Xst select the modes for the specified users:

read , write, execute
eXecute only if the file is a directory or already has execute permission for some user
Set user or group ID on execution
Save program text on swap device ( a performance enhancer )

For a directory mode means: read:list files, write:add, execute:access


Numeric mode:

(1-4 digits)
first digit special attributes for
usually not used
SetGID 2000
second digit owner
read 400
write  200
execute  100
third digit group
read 040
write  020
execute  010
fourth digit other
users NOT in the file's group
read 004
write  002
execute  001

The mode is calculated by adding the values
Owner (rwx) = 400+200+100= 700 ; Group(rx) = 40+10 = 50; Other (rx) = 4+1 = 5
mode = 755
Setting mode to 777 should be avoided as this permits anyone to modify the file.

mode calculator
owner  group  other

The mode of symbolic links are not changed since they are not used.
The mode of the target file are changed except during recursive directory traversals.

This page documents the GNU version of chmod.

see also:
ls -l lists current permissions for -- u (owner) rwx -- g (group) rwx -- O (Other) rwx --
chgrp - Change group ownership
chown - Change file owner and group
umask - sets "allowed" filter
Windows equivalent commands:
ATTRIB - Change file attributes
CACLS - Change AccessControlList settings
XCACLS - Change file permissions

and for us Mac ers