Skip to content
Tutorials Center
My learning

Topics

Linux Command Reference ยท Systemd and Logging (Read-Only)

systemd targets

systemd targets group units into boot states and replace SysV runlevels: multi-user.target, graphical.target, rescue.target, get-default, isolate and set-default.

A target is a unit with no process of its own. It exists as a named goal that other units attach to, such as "the system is up in text mode" (multi-user.target) or "the network is configured" (network-online.target). Reaching a target means starting everything it wants and requires.

Targets replace the old SysV runlevels. The default target is what the machine boots into, and you can switch the running system to another with systemctl isolate. Changing targets needs root and a real systemd, so this page is read-only; the examples map runlevels and read sample symlinks.

Terminal
systemctl get-default
sudo systemctl set-default multi-user.target
sudo systemctl isolate rescue.target
systemctl list-dependencies multi-user.target

Try it

Bash Runlevels and their target names

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Bash How WantedBy attaches a unit to a target

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Syntax

Terminal
systemctl get-default
systemctl set-default TARGET
systemctl isolate TARGET
systemctl list-units --type=target
systemctl list-dependencies TARGET
Target Description
poweroff.target, reboot.target, halt.target Shut down, reboot, halt (runlevels 0 and 6).
rescue.target Single-user maintenance shell with basic services (runlevel 1).
emergency.target Bare root shell on a read-only root filesystem; used when even rescue fails.
multi-user.target Full multi-user system without a desktop (runlevels 2-4).
graphical.target Multi-user plus a display manager (runlevel 5).
default.target Alias for the target used at boot, normally multi-user or graphical.
network.target, network-online.target Network software started; network configured and reachable.
sysinit.target, basic.target Early boot stages that most services order themselves after.
timers.target, sockets.target Hooks that collect all timer and socket units.

Returns: get-default prints the target name. isolate stops every unit not required by the new target, so use it with care.

Errors and edge cases: isolate works only for targets that set AllowIsolate=yes; others refuse. You can also pick a target for a single boot by appending systemd.unit=rescue.target to the kernel command line.

Usage notes

  • Targets are for grouping. They are the right WantedBy= for most services; use multi-user.target for server software.
  • isolate multi-user.target on a desktop machine closes the graphical session; save your work first.
  • rescue.target needs the root password on most systems. If you cannot log in, boot with systemd.unit=rescue.target and see the recovery lesson.
  • Old tools still work: runlevel and telinit 3 are translated to targets by compatibility links.
  • Order versus membership. A target pulls units in through Wants= links, but ordering still comes from After=: see Unit dependencies.
  • See what a boot waited for with systemd-analyze critical-chain multi-user.target: systemd-analyze.
  • Servers in containers may have no default target at all; then there is nothing to isolate.