Linux command: umask

Quick startumaskCommand, used to set the default permissions of the file

When creating a file, there is no need to pre-determine permissions. The permissions have default values.

can useumaskcommand.

typeumaskIf there are no parameters, the current umask will be displayed, in this case0022:

What is it0022meaning is? This is an octal value representing authority.

Another common value is0002.

useumask -SSee the human-readable symbol:

In this case, the user (u) (The owner of the file) has read, write and execute permissions on the file.

Other users belonging to the same group (g) Has read and execute permissions for all other users (o).

In number symbols, we usually change the last 3 digits.

This is a list that gives the meaning of the numbers:

  • 0Read, write, execute
  • 1Read and write
  • 2Read and execute
  • 3Read only
  • 4Write and execute
  • 5just write
  • 6Execute only
  • 7Permission denied

Please note that this number symbol is different from the number symbol we use in itchmod.

We can set a new value for the mask and set the value in numeric format:

umask 002

Or you can change the permissions of a specific role:

umask g+r

ThisumaskThis command can be used in Linux, macOS, WSL and wherever you have a UNIX environment

Download mine for freeLinux Command Manual


More cli tutorials: