umask - Set or return the file mode creation mask
Format
umask [-S] [mode]
tcsh shell: umask [value]
Description
umask sets the file-creation permission-code mask of the invoking process to the given mode. You can specify the mode in any of the formats that are recognized by chmod. For more information, see chmod for more information.
The mode can be specified in symbolic (rwx
) or octal
format. The symbolic form specifies what permissions are allowed. The octal form specifies what
permissions are disallowed.
The file-creation permission-code mask (often called the umask) modifies the default (initial) permissions for any file that is created by the process. The umask specifies the permissions which are not to be allowed.
umask a=rx
you have allowed files to be created with read and execute
access for all users. If you were to look at the mask, it would be 0222. The write bit is set,
because write is not allowed. If you want to permit created files to have read, write, and execute
access, then set umask to 0000. If you call umask without a
mode argument, umask displays the current
umask.To calculate the permissions that will result from specific umask values, subtract the umask from 666 for files, and from 777 for directories For example, a umask of 022 results in permissions of 644.
In the tcsh shell, umask sets the file creation mask to
value, which is given in octal. Common values for the mask are
002
, giving all access to the group and read and execute access to others, and
022
, giving read and execute access to the group and others. Without
value, umask prints the current file creation
mask. For more information, see tcsh - Invoke a C shell.
Options
- -S
- Displays the umask in a symbolic form:
giving owner, group and other permissions. Permissions are specified as combinations of the letters r (read), w (write), and x (execute).u=perms,g=perms,o=perms
Localization
- LANG
- LC_ALL
- LC_CTYPE
- LC_MESSAGES
- NLSPATH
Exit values
0
- Successful completion.
1
- Failure due to an incorrect command-line argument, or incorrect mode.
Portability
POSIX.2, X/Open Portability Guide, UNIX systems.
Related information
chmod, tcsh