The shell umask is 002 and mkdir requests the normal directory mode 0777.
Assume no default ACL or other additional factor.
What mode is created?
Directories normally start from 0777. With umask 002, only the other's write bit is removed, producing 0775.
Detailed explanation
0775Correct. 0777 with umask 002 produces 0775.
Correct. 0777 with umask 002 produces 0775.
0777Incorrect. That would be the unmasked base mode.
Incorrect. That would be the unmasked base mode.
0664Incorrect. 0664 is a common regular-file result, not a directory result here.
Incorrect. 0664 is a common regular-file result, not a directory result here.
0002Incorrect. The umask is not the resulting mode.
Incorrect. The umask is not the resulting mode.
Try it yourself
An example you can run in a temporary verification environment.
umask 002; umaskExpected result
0002Key points
- Directory base mode is 0777
- Remove other's write bit
- The result is 775
Notes
- Environment: Bash 5.2/POSIX umask
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.