#compsci 

## Overview
Systemd uses goals to boot up your system. Basically, you have a target that you want to achieve and this target also has dependencies that we need to achieve.
Typical systemd boot process algorithm:
1. Systemd loads in config files (/etc/systemd/system/ OR /usr/lib/systemd/system/)
2. Systemd determines its boot goal (usu default.target)
3. Systemd figures out the dependencies of the boot target and activates them

Similar to [[Sys V]] runlevels, systemd boots into different targets:
- poweroff.target - shutdown system
- rescue.target - single user mod
- multi-user.target - multiuser with networking
- graphical.target - multiuser with networking and GUI
- reboot.target - restart

The main object that systemd works with is known as a **unit**.
The most common units:
- service units (.service)
- mount units (mount filesystems, .mount)
- target units (group together other units, .target)

## Goals
Basic unit file:

```[Unit]
Description=My Foobar
Before=bar.target

[Service]
ExecStart=/usr/bin/foobar

[Install]
WantedBy=multi-user.target
```

List units:
$ systemctl list-units

View the status of a unit
$ systemctl status %unit%