Linux umask Command
The Linux umask command specifies the default permission mask for newly created files.
umask is used to set the [permission mask]. The [permission mask] consists of three octal digits, and by subtracting the existing access permissions from the permission mask, the default permissions for newly created files are generated.
Syntax
umask [-S][permission mask]
Parameter Description:
-S Display the permission mask in symbolic form.
Example
To view the current permission mask using the "umask" command, enter the following command:
$ umask # Get the current permission mask
After executing the above command, the output is as follows:
0022
Next, create a directory using the "mkdir" command and get detailed information about the directory using the "ls" command by entering the following commands:
$ mkdir test1 # Create a directory
$ ls -d -l test1/ # Display detailed information about the directory
After executing the above commands, the detailed information of the newly created directory will be displayed as follows:
drwxr-xr-x 2 rootlocal rootlocal 4096 2011-9-19 21:46 test1/
Note: In the output above, "drwxr-xr-x" = "777-022=755".