Set umask to 002 in a collaborative shell and create a directory with mkdir.
What mode is normally created?
Directories start from 777; masking 002 removes other's write bit and produces 775.
Detailed explanation
755Incorrect. 755 would also remove group write, which umask 002 does not mask.
Incorrect. 755 would also remove group write, which umask 002 does not mask.
775Correct. 0777 with umask 0002 produces 0775.
Correct. 0777 with umask 0002 produces 0775.
664Incorrect. 664 is a regular-file-style mode.
Incorrect. 664 is a regular-file-style mode.
002Incorrect. The umask itself is not the resulting directory mode.
Incorrect. The umask itself is not the resulting directory mode.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); (umask 002; mkdir "$tmp/team"); stat -c '%a' "$tmp/team"; rm -rf "$tmp"Expected result
775Key points
- Directory base mode is 777
- umask 002
- Group write remains
Notes
- Environment: POSIX shell / GNU stat
- 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.