Display the current defaults used by useradd without creating a user.
Which command is appropriate?
useradd -D displays current defaults such as the base home directory and login shell.
Detailed explanation
useradd -mIncorrect. -m is a creation option and a username is required.
Incorrect. -m is a creation option and a username is required.
useradd -rIncorrect. -r creates a system account.
Incorrect. -r creates a system account.
usermod -DIncorrect. Defaults are displayed by useradd, not usermod.
Incorrect. Defaults are displayed by useradd, not usermod.
useradd -DCorrect. useradd -D prints the current defaults.
Correct. useradd -D prints the current defaults.
Try it yourself
An example you can run in a temporary verification environment.
useradd -DExpected result
GROUP、HOME、SHELLなどの既定値一覧Key points
- -D means defaults
- It does not create a user
- Use it to inspect defaults
Notes
- Environment: shadow-utils useradd / 読み取りのみ
- 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.