Displays or sets the file mode creation mask.
umask [ -S ] [ Mask ]
If the Mask parameter is not specified, the umask command displays to standard output the file mode creation mask of the current shell environment. If you specify the Mask parameter using a three-digit octal number or symbolic code, the umask command sets the file creation mask of the current shell execution environment. The bits set in the file creation mask are used to clear the corresponding bits requested by an application or command when creating a file.
The chmod command describes how to use the symbolic and numeric codes to set permissions.
The -S flag produces symbolic output. If the flag is not specified, the default output format is octal.
If the /usr/bin/umask command is called in a subshell or separate command execution environment, it does not affect the file mode creation mask of the caller's environment. This would be the case in the following example:
(umask 002)
nohup umask ...
find . -exec umask ... \;
-S | Produces symbolic output. |
The following exit values are returned:
0 | The file mode creation mask was successfully changed, or no Mask parameter was supplied. |
>0 | An error occurred. |
umask a=rx,ug+w
OR
umask 002
After setting the mode mask, display the current values of the mode mask by entering:
umask
The screen displays the following value:
02
umask -S
The screen displays the following values:
u=rwx,g=rwx,o=rx
umask g-w
umask -- -w
Note: The -r, -w, and -x Mask parameter values (or anything beginning with a hyphen) must be preceded by -- (double hyphen, no space between) to keep it from being interpreted as an option.
/usr/bin/ksh | Contains the Korn shell umask built-in command. |
/usr/bin/umask | Contains the umask command. |
The bsh command, chmod command, csh command, ksh command.