List target units currently loaded by systemd without changing state.
Which command is appropriate?
systemctl list-units --type=target lists loaded target units and their active state.
Detailed explanation
systemctl list-units --type=targetCorrect. This lists target units known to the running system manager.
Correct. This lists target units known to the running system manager.
systemctl isolate --allIncorrect. isolate changes the current target and does not accept --all for this query.
Incorrect. isolate changes the current target and does not accept --all for this query.
systemctl set-default --listIncorrect. set-default --list is not the listing operation.
Incorrect. set-default --list is not the listing operation.
systemctl reboot --targetsIncorrect. reboot changes system state rather than listing units.
Incorrect. reboot changes system state rather than listing units.
Try it yourself
An example you can run in a temporary verification environment.
systemctl list-units --type=target --no-pager 2>/dev/null | head || trueExpected result
読み込まれているtarget unitの一部Key points
- list-units
- --type=target
- Unit state
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.