Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

umask

Gets or sets the process file-creation permission mask.

With an argument, sets the umask to the given value and returns the previous mask. Without an argument (or with undef), queries the current mask by temporarily setting it to 0 and restoring it, then returns the value.

The umask affects the default permissions of newly created files and directories. The actual permissions are requested & ~umask.

Returns the previous umask as an integer (typically displayed in octal).

Synopsis

my $old_mask = umask(0022);  # Set new mask, return old
my $current  = umask();      # Query current mask

See Also

chmod, mkdir, open