Inspect the target systemd will use for the next normal boot without changing it.
Which command is appropriate?
systemctl get-default prints the target resolved by default.target for normal boot.
Detailed explanation
systemctl isolate default.targetIncorrect. isolate changes the current target.
Incorrect. isolate changes the current target.
systemctl enable default.targetIncorrect. enable changes boot-time activation and is not a read-only query.
Incorrect. enable changes boot-time activation and is not a read-only query.
systemctl get-defaultCorrect. systemctl get-default displays the configured default target.
Correct. systemctl get-default displays the configured default target.
systemctl reboot --dry-runIncorrect. reboot changes system state rather than inspecting the default.
Incorrect. reboot changes system state rather than inspecting the default.
Try it yourself
An example you can run in a temporary verification environment.
systemctl get-default 2>/dev/null || trueExpected result
multi-user.targetやgraphical.target等Key points
- get-default
- default.target
- Read-only check
Notes
- Environment: systemd採用Linux
- 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.