On a systemd system, inspect the target selected for normal future boots.
Show the configured default rather than all currently reached targets.
Which command is correct?
systemctl get-default prints the target linked by default.target, such as graphical.target or multi-user.target.
Detailed explanation
systemctl get-defaultCorrect. get-default prints the configured default target.
Correct. get-default prints the configured default target.
systemctl list-units --type=targetIncorrect. list-units lists target units but does not identify only the default.
Incorrect. list-units lists target units but does not identify only the default.
systemctl isolate default.targetIncorrect. isolate changes the current active state.
Incorrect. isolate changes the current active state.
systemctl status systemdIncorrect. status shows service status and is not the direct default-target query.
Incorrect. status shows service status and is not the direct default-target query.
Try it yourself
An example you can run in a temporary verification environment.
systemctl get-default 2>/dev/null || echo 'systemd is not PID 1'Expected result
graphical.targetやmulti-user.target、または非systemd環境の表示Key points
- get-default is read-only
- default.target represents the default
- It differs from current active targets
Notes
- Environment: Linux / systemd 255以降
- 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.