A target is a systemd unit that groups other units into a logical state, roughly analogous to the SysV runlevel. Booting the system means reaching a target; shutting down means reaching poweroff.target. Targets have no behaviour of their own; they are purely synchronisation points in the dependency graph.
Common targets include:
- poweroff.target: halt the system
- rescue.target: single-user mode
- multi-user.target: text-mode multi-user (runlevel 3)
- graphical.target: multi-user with display manager (runlevel 5)
- reboot.target: reboot
- emergency.target: minimal emergency shell
The default target, usually graphical.target on desktops, multi-user.target on servers, is what systemd boots into. It is a symlink at /etc/systemd/system/default.target:
systemctl get-default
sudo systemctl set-default multi-user.target
sudo systemctl isolate rescue.target # switch on the fly
User-defined targets can group related services: a my-app.target that pulls in several services makes it easy to start and stop them together. Targets are the systemd generalisation of the old runlevel concept, and a vast improvement on it.
Related terms: systemd, systemd Unit, runlevel
Discussed in:
- Chapter 13: System Services and systemd · Units: The systemd Object Model
Also defined in: Textbook of Linux
