Get or set the file mode creation mask (POSIX)
umask [-o|-s|mask]
If the mask is specified in octal form, it replaces the current file mode creation mask. Every bit that is set describes a mode bit that won't be allowed in the file mode of created files. In other words, it says: "mask this bit off."
The symbolic form of the mask is an expression that modifies or replaces the current file mode creation mask. The form of the symbolic mask is similar to that of the mode operand for the chmod utility:
The umask utility sets the file mode creation mask of the invoking process to the value specified by the mask operand. The file mode creation mask affects the initial value of the file permission bits of subsequently created files when no mode is specified.
When files are created without specifying the permission mode bits, the filesystem assigns default permissions of 0777 (rwxrwxrwx) to directories and executable files, thereby giving read, write, and execute privileges for user, group, and others. For files that are not executable, permissions of 0666 (rw-rw-rw-) are assigned. The umask utility is used to adjust these defaults.
The file mode creation mask is inherited by any children of the current process.
Either of the display forms (-o or -s) can be used as the mask operand to a subsequent invocation of the umask utility.
As in the chmod utility, the use of the octal number form of mask values is deprecated.
$ umask a=rwx
Display the current file creation mode mask in symbolic form:
$ umask -s u=rwx, g=rwx, o=rwx
Display the current file creation mode mask in octal:
$ umask -o 00
$ umask u=rw
Display the current file creation mode mask in symbolic form:
$ umask u=rw,g=,o=
Display the current file creation mode mask in octal:
$ umask -o 0177
$ umask go+r
Display the current file creation mode mask in symbolic form:
$ umask u=rw,g=r,o=r
Display the current file creation mode mask in octal:
$ umask -o 0133
If any error occurs, the value of the process's file mode creation mask is left unmodified.