umask
Display or set file mode mask.[1]
Sets the user file-creation mask to MODE. If MODE is omitted, prints the current value of the mask.[1]
If MODE begins with a digit, it is interpreted as an octal number; otherwise it is a symbolic mode string like that accepted by chmod.[1]
Documentation
- umask [EN] @ GNU Bash Reference Manual
- bash -c 'help umask'
- man 1 'bash' [EN]
Further Information
- Set a custom umask in macOS (25.06.2020) [EN] @ Apple
Syntax
umask [PARAMETER ...] [MODE]
Parameters
- -S
- Makes the output symbolic; otherwise an octal number is output.
Examples
- Get and set umask
umask
Output:
0022
touch 'test1'
ls -l 'test1'
Output:
-rw-r--r-- 1 alex alex 0 May 7 15:46 test1
umask 0007
touch 'test2'
ls -l 'test2'
Output:
-rw-rw---- 1 alex alex 0 May 7 15:50 test2