umask

From RaySoft

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

Further Information

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

References

  1. 1.0 1.1 1.2 bash -c 'help umask'