Intermediate Package: coreutils / bash builtin

umask

View or set the default permission mask for new files.

Syntax

umask [mode]

Description

umask controls which permission bits are removed from new files and directories at creation time. The current shell's value is shown when run with no arguments, and it is commonly set in shell profiles or service definitions.

Examples

umask
Show the current mask (often 0022)
umask 077
Make new files private to their owner by default
umask 0002
Common setting for shared group-writable directories

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux

Put it into practice

Learn this in context