The umask Command

The umask command sets the file-creation mask using this format:


where mask is an octal number or symbolic value that correspond to the permissions to be disabled. Here, the write and execute permissions for group and others are removed:

					$ umask 033
					$ touch tmp
					$ ls -l tmp
					-rw-r--r--  1 root 9 Sep  2 11:18 tmp

This umask command adds write permission to the group:

					$ umask 013
					$ touch tmp1
					$ ls -l tmp1
					-rw-rw-r--  1 root 9 Sep  2 11:19 tmp1

To remove read permission for other using symbolic format:

					$ umask o-r
					$ touch tmp2
					-rw-rw----  1 root 9 Sep  2 11:23 tmp2

With no arguments, umask displays the current value. This umask is set to remove write permission for group and others:

					$ umask

Get Korn Shell: Unix and Linux Programming Manual, Third Edition, The now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.