Working with systemd targets on RHEL7 Linux beginners cheatsheet

Below you can find a list of most frequently used commands in association with systemd targets:

List current active default target

# systemctl get-default

List all active systemd targets:

# systemctl list-units --type target

List all available targets disregarding their state ( active, inactive ):

# systemctl list-units --type target -a

List all inactive systemd targets:

# systemctl list-units --type target --state=inactive

List all installed files associated with systemd targets:

# systemctl list-unit-files --type target

Change a default target eg. change default target to

graphical.target

:

# systemctl set-default graphical.target

or

# systemctl enable graphical.target --force

Change current session target eg. to

graphical.target

:

# systemctl isolate graphical.target

Change to rescue mode:

# systemctl rescue

Change to emergency mode:

# systemctl emergency

Reboot system:

# systemctl isolate  reboot.target

Shutdown system:

# systemctl isolate  poweroff.target