Umask Command in Linux - Step by step guide
This article covers how to use the umask command in Linux. In fact, the umask command alters the default permissions on newly created files and directories.
How to fix umask: command not found Linux error ?
If you encounter the below error while executing the umask command:
$ umask: command not found
You can install it to your system by running the respective commands:
For OS X, simply run the command:
$ brew install bash
For Debian, run the below command:
$ apt-get install execline
For Ubuntu, run the command:
$ apt-get install execline
For Alpine, run the below command:
$ apk add bash
For Arch Linux, run the below command:
$ pacman -S bash
For Kali Linux, run the below command:
$ apt-get install execline
For CentOS, run the below command:
$ yum install bash
For Fedora, execute the command:
$ dnf install bash
For Raspbian, run the command:
$ apt-get install bash
Different ways of using umask Command:
1. Display the current mask in octal notation:
$ umask
2. Display the current mask in symbolic (human-readable) mode:
$ umask -S
3. Change the mask symbolically to allow read permission for all users (the rest of the mask bits are unchanged):
$ umask a+r
4. Set the mask (using octal) to restrict no permissions for the file's owner, and restrict all permissions for everyone else:
$ umask 077