Notes to Self

Alex Sokolsky's Notes on Computers and Programming

systemctl targets

This is about working with targets. Other aspects of systemctl.

List Targets

systemctl list-units --type=target

or

systemctl list-unit-files --type=target

Display the default target

By default, the systemd process uses the default target when booting the system. To view the default target on your system:

systemctl get-default

To set a different target as a default target, e.g. graphical.target:

sudo systemctl set-default graphical.target

Change the current active target

To change the current active target immediately, e.g. to switch from the current graphical target (GUI) to the multi-user target (CLI):

sudo systemctl isolate multi-user.target

Boot the system in Single User mode

If your system unable to complete a regular boot, you can boot it into the rescue (single-user) mode for further troubleshooting.

sudo systemctl rescue

In rescue mode the system tries to mount all the local file systems and start only few important system services, but it does not activate network interfaces or allow more users to log into the system at the same time.

Boot the system in Emergency mode

If the Rescue/Single User mode does not boot, try Emergency mode.

In emergency mode, the system mounts the root file system for read-only purposes and does not attempt to load any other local file systems. Network interfaces are not activated. Only essential services are started.

sudo systemctl emergency

Power management

systemctl also allows users to halt, shutdown and reboot a system.

sudo systemctl halt
sudo systemctl poweroff
$ sudo systemctl reboot