# Linux commands: umask

> Learn how the Linux umask command sets the default permissions for new files, reading octal values like 0022 and the -S human-readable notation.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2020-09-29 | Topics: [CLI](https://flaviocopes.com/tags/cli/) | Canonical: https://flaviocopes.com/linux-command-umask/

When you create a file, you don't have to decide permissions up front. Permissions have defaults.

Those defaults can be controlled and modified using the `umask` command.

Typing `umask` with no arguments will show you the current umask, in this case `0022`:

![Terminal showing umask command output displaying 0022](https://flaviocopes.com/images/linux-command-umask/Screen_Shot_2020-09-04_at_09.04.19.png)

What does `0022` mean? That's an octal value that represent the permissions.

Another common value is `0002`.

Use `umask -S` to see a human-readable notation:

![Terminal showing umask -S command output displaying u=rwx,g=rx,o=rx permissions](https://flaviocopes.com/images/linux-command-umask/Screen_Shot_2020-09-04_at_09.08.18.png)

In this case, the user (`u`), owner of the file, has read, write and execution permissions on files.

Other users belonging to the same group (`g`) have read and execution permission, same as all the other users (`o`).

In the numeric notation, we typically change the last 3 digits.

Here's a list that gives a meaning to the number:

- `0` read, write, execute
- `1` read and write
- `2` read and execute
- `3` read only
- `4` write and execute
- `5` write only
- `6` execute only
- `7` no permissions

Note that this numeric notation differs from the one we use in `chmod`.

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

```bash
umask 002
```

or you can change a specific role's permission:

```bash
umask g+r
```

> The `umask` command works on Linux, macOS, WSL, and anywhere you have a UNIX environment
