O'Reilly logo

Korn Shell: Unix and Linux Programming Manual, Third Edition, The by Anatole Olczak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The umask Command

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

					umask
					mask
				

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
					022
				

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required