umask

Official Description

Displays or sets the file mode creation mask.

Syntax

umask [-S] [mask]

Options

-S produces symbolic output.

Oddities

The one's complement of the umask value is bitwise or'ed with octal 666 (for regular files) or octal 777 (for directories) to determine the permission to set on a new file or directory.

Octal? Isn't this the twenty-first century? It shows the PDP 11 origins of UNIX.

Example

$ umask
0002
$
$ umask -S
u=rwx,g=rwx,o=rx
$
				

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.