Forrest logo
back to the umask tool

umask:tldr:f2eda

umask: Display the current mask in octal notation.
$ umask
try on your machine

The umask command is a built-in command in Unix-like operating systems. It is used to set the default file permission mask for newly created files and directories.

The umask value is a three-digit octal number that represents the permissions to be disabled from the newly created files and directories. It operates by subtracting the umask value from the default permissions, effectively removing the specified permissions.

The umask value is subtracted from 777 (read, write, and execute permissions for all) for files, and 666 (read and write permissions for all) for directories. This results in the permissions for newly created files and directories being calculated based on the following formula:

New file permissions = 666 - umask New directory permissions = 777 - umask

By default, when a file or directory is created, it inherits the permissions from the parent directory. However, the umask value determines which permissions are removed from the inherited default permissions.

For example, if the umask value is set to 022, it means that the write permission for group and others will be denied for newly created files, and write and execute permission for group and others will be denied for newly created directories.

The umask command is usually set in the shell startup files, such as .bashrc or .profile, to ensure that the desired default permissions are applied to newly created files and directories.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the umask tool