Home·Terminal commands

umask

Permissions

Usage

umask 022

Decides which permission bits are withheld from newly created files; it subtracts rather than grants, so 022 yields 644 for files and 755 for directories, and it never touches files that already exist.

Common flags

FlagMeaning
022The bits to withhold: files become 644, directories 755
077Nothing for group or others: files 600, directories 700
-SShow the mask as u=rwx,g=rx,o=rx instead of a number
-pPrint it in a form a script can reuse

Examples

umask

Prints the current mask, usually 022.

umask 077

New files become readable by you alone.

umask -S

The same mask in symbolic form.

Numeric and symbolic modes name the same thing: 755 and u=rwx,go=rx are the same permission.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does umask do?

Decides which permission bits are withheld from newly created files; it subtracts rather than grants, so 022 yields 644 for files and 755 for directories, and it never touches files that already exist.

Q. How do I type it?

umask 022 — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

4 are listed here; the full set is in man umask. This command sits under Permissions.

Related commands

man page: man umask