Linux command
umask 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Show current mask
umask
Show symbolic
umask -S
Set mask
umask [022]
Restrictive mask
umask [077]
Permissive mask
umask [000]
Set symbolic mask
umask u=rwx,g=rx,o=rx
说明
umask is a shell builtin that sets or displays the file creation mask, which controls the default permissions assigned to newly created files and directories. The mask specifies which permission bits to remove from the maximum default permissions (666 for files, 777 for directories). For example, a umask of 022 removes write permission for group and others, resulting in files created with 644 and directories with 755. A more restrictive umask of 077 removes all permissions for group and others. The umask can be specified in octal notation (e.g., 022) or symbolic notation (e.g., u=rwx,g=rx,o=rx). Changes apply only to the current shell session unless set in shell profile files like ~/.bashrc.
参数
- -S
- Symbolic output.
FAQ
What is the umask command used for?
umask is a shell builtin that sets or displays the file creation mask, which controls the default permissions assigned to newly created files and directories. The mask specifies which permission bits to remove from the maximum default permissions (666 for files, 777 for directories). For example, a umask of 022 removes write permission for group and others, resulting in files created with 644 and directories with 755. A more restrictive umask of 077 removes all permissions for group and others. The umask can be specified in octal notation (e.g., 022) or symbolic notation (e.g., u=rwx,g=rx,o=rx). Changes apply only to the current shell session unless set in shell profile files like ~/.bashrc.
How do I run a basic umask example?
Run `umask` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -S do in umask?
Symbolic output.