English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux umask command

Linux Command大全

The Linux umask command specifies the default permission mask when creating files.

umask can be used to set [Permission Mask]. [Permission Mask] is composed of3A number in octal, which subtracts the permission mask from the existing access permissions to produce the default permissions when creating files.

Syntax

umask [-S][Permission Mask]

Parameter Description:

-S  To represent permissions with text.

Online Examples

Use the command "umask" to view the current permission mask, then enter the following command:

$ umask                         #Get the current permission mask 

After executing the above instructions, the output information is as follows:

0022

Next, use the command "mkdir" to create a directory, and use the command "ls" to get the detailed information of the directory. Enter the following command:

$ mkdir test1                       #Create Directory  
$ ls –d –l test1/                   #Display the detailed information of the directory  

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 information above, "drwxr-xr-x"="777-022=755".

Linux Command大全