Linux umask command
The Linux umask command specifies the default permission mask when creating files.
umask can be used to set the [permission mask]. The [permission mask] is composed of three octal digits. Subtracting the permission mask from the existing access permissions produces the default permissions when creating files.
Syntax
umask [-S][权限掩码]
Parameter description:
-S Displays the permission mask in text format.
Examples
Use the command "umask" to view the current permission mask, enter the following command:
$ umask #获取当前权限掩码
After executing the above command, the output information is as follows:
0022
Next, use the command "mkdir" to create a directory, and use the command "ls" to get detailed information about that directory. Enter the following command:
$ mkdir test1 #创建目录 $ ls –d –l test1/ #显示目录的详细信息
After executing the above command, 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".
Other Extensions
Linux Command Encyclopedia