chmod

Official Description

Changes file-access permissions.

Syntax

chmod [option] mode
					file(s)
				

Options

-R causes chmod to recursively descend its directory arguments, setting the mode for each file.

-f suppresses most error messages; forces the change.

-v stands for verbose and outputs a diagnostic for every file processed.

Oddities

Has a numeric form (755) and a mnemonic form (ug+x).

Example

$ ls -l buzz
-rwxrwxr--   1 obrien   obrien         47 Nov 26 12:19 buzz
$
$ chmod o+x buzz             # Add execute access for others
$
$ ls -l buzz
-rwxrwxr-x   1 obrien   obrien         47 Nov 26 12:19 buzz
$
$ chmod 007 buzz             # No access for user and group,
                             # all access to others
$
$ ls -l buzz
-------rwx 1 obrien obrien 47 Nov 26 12:19 buzz $ $ buzz # Others can execute, user (owner) ...

Get Korn Shell Programming 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.