Show Menu
Cheatography

Features

Socket­-based activation
Bus-based activation
Device­-based activation
Path-based activation
Mount and automount point management
Aggressive parall­eli­zation
Transa­ctional unit activation logic
Backwards compat­ibility with SysV init

Config­uration

/etc/s­yst­emd­/sy­ste­m.conf override default config­uration

Unit Types

.service A system service
.target A group of systemd units
.automount A file system automount point
.device A device file recognized by the kernel
.mount A file system mount point
.path A file or directory in a file system
.scope An externally created process
.slice A group of hierar­chi­cally organized units that manage system processes
.snapshot A saved state of the systemd manager
.socket An inter-­process commun­ication socket
.swap A swap device or a swap file
.timer A systemd timer

Unit File Locations

/usr/l­ib/­sys­tem­d/s­ystem/ Systemd unit files distri­buted with installed packages
/run/s­yst­emd­/sy­stem/ Systemd unit files created at run time
/etc/s­yst­emd­/sy­stem/ Systemd unit files for extending a service

Logs

journalctl -b show all messages from this boot
journalctl -b -1 show all messages from previous boot
journalctl --sinc­e="2­012­-10-30 18:17:­16" show all messages from date and optional time
journalctl --since "20 min ago" show all messages since 20 minutes ago
journalctl -f show new messages
journalctl /usr/l­ib/­sys­tem­d/s­ystemd show all messages by a specific executable
journalctl _PID=1 show all messages by a specific process
journalctl -u man-db.se­rvice show all messages by a specific unit
journalctl -k show kernel ring buffer:
journalctl -p err..alert Show only error, critical, and alert priority messages
journalctl SYSLOG­_FA­CIL­ITY=10 show auth.log equivalent by filtering on syslog facility
journalctl --file /var/l­og/­jou­rna­l/*­/sy­ste­m.j­ournal -f force journalctl to look only into most recent journal
journalctl --vacu­um-­siz­e=100M remove archived journal files until the disk space they use falls below 100M
journalctl --vacu­um-­tim­e=2­weeks make all journal files contain no data older than 2 weeks

Boot Management

bootctl --path=esp status shows brief inform­ation about the system firmware
bootctl --path=esp install installs system­d-boot into the EFI system partition
bootctl --path=esp update updates all installed versions of system­d-boot
bootctl --path=esp remove removes all installed versions of system­d-boot
bootctl --path=esp list shows all available boot loader entries
bootctl --path=esp set-de­fault ID sets the default boot loader entry

Control Group Management

system­d-cgls shows the cgroup hierarchy in a pretty tree

Device Management

udevadm info options devpath query the udev database for device inform­ation
udevadm trigger options devpath request device events from the kernel
udevadm settle options watches the udev event queue
udevadm control option modify the internal state of the running udev daemon
udevadm monitor options listens to the kernel uevents
udevadm test options devpath simulate a udev event run for the given device and print debug output

Coredump Management

coredu­mpctl list list core dumps
coredu­mpctl info show inform­ation about core dump
coredu­mpctl dump extract the core dump
coredu­mpctl debug invoke debugger on a core dump

Hostname Management

hostna­mectl status show current system hostname and related inform­ation
hostna­mectl set-ho­stname name set the system hostname to name
 

Services

systemctl list-units --type service list all currently loaded service units
systemctl list-units --type service --all list all loaded service units regardless of their state
systemctl list-u­nit­-files --type service list all available service units to see if they are enabled
systemctl status name.s­ervice show detailed inform­ation about a service unit
systemctl is-active name.s­ervice verify a particular service unit is running
systemctl is-enabled name.s­ervice verify a particular service unit is enabled
systemctl list-d­epe­nde­ncies --after name.s­ervice show units ordered to start before a service unit
systemctl list-d­epe­nde­ncies --before name.s­ervice show units ordered to start after a service unit
systemctl start name.s­ervice start a service unit
systemctl stop name.s­ervice stop a service unit
systemctl restart name.s­ervice restart a service unit
systemctl try-re­start name.s­ervice restart a service unit if corres­ponding service running
systemctl reload name.s­ervice reload service unit config­uration file
systemctl enable name.s­ervice enable service unit
systemctl reenable name.s­ervice reenable service unit
systemctl disable name.s­ervice disable service unit
systemctl mask name.s­ervice mask service unit to prevent from being started
systemctl unmask name.s­ervice unmask a service unit
systemctl daemon­-reload notify new service file exists
system­d-delta show overridden units

Locale

localectl status show current status
localectl list-l­ocales list available locales
localectl set-locale LANG=locale set new locale
localectl list-k­eymaps list available keymaps
localectl set-keymap map set new keymap
localectl set-x1­1-k­eymap map set console and x11 keymap
localectl --no-c­onvert set-x1­1-k­eymap map set x11 keymap

Date and Time

timeda­tectl show current date and time
timeda­tectl set-time HH:MM:SS change current time
timeda­tectl set-lo­cal-rtc boolean set clock in local time
timeda­tectl set-time YYYY-MM-DD change current date
timeda­tectl list-t­ime­zones list all available time zones
timeda­tectl set-ti­mezone time_zone set new timezone
timeda­tectl set-ntp boolean set or unset NTP service

Container Management

system­d-n­spawn -b -D /path/­to/­os/tree run OS in a namespace container
system­d-n­spawn -b -D /path/­to/­os/tree -M machin­e_name --netw­ork­-br­idge=bridge­_name run OS in a namespace container
Ctril+]]] kill the container from inside
machinectl list list currently running containers
machinectl status machin­e_name show runtime status inform­ation about the container
machinectl show machin­e_name show properties about the container
machinectl start machin­e_name start container as a system service by the name in /var/l­ib/­mac­hines/
machinectl login machin­e_name open an intera­ctive terminal login session in container
machinectl shell opean an intera­ctive shell session in a container
machinectl enable machin­e_name enable a container as a system service
machinectl disable *machi­ne_name disable a container as a system service
machinectl reboot machin­e_name reboot a container
machinectl terminate machin­e_name terminates a container
machinectl kill machin­e_name send a signal to processes of the container
machinectl bind machin­e_name host_path contai­ner­_path bind mounts from the host into the container
machinectl copy-to machin­e_name host_path contai­ner­_path copies from the host into a running container
machinectl copy-from machin­e_name contai­ner­_path host_path copies from container into the host system
 

Network Management

networkctl list show list of links
networkctl status link show inform­ation about specified link
networkctl lldp link show LLDP neighbors
networkctl label show numerical address labels
systemctl start system­d-n­etw­ork­d.s­ervice start system­d-n­etworkd daemon
systemctl enable system­d-n­etw­ork­d.s­ervice start system­d-n­etworkd daemon at boot

Domain Name Management

systemctl start system­d-r­eso­lvd.se­rvice start system­d-r­esolved daemon
systemctl enable system­d-r­eso­lve­d.s­ervice start system­d-r­esolved daemon at boot
resolvectl query www.ex­amp­le.com show the address of the www.ex­amp­le.com domain
resolvectl query 8.8.8.8 show the domain of the 8.8.8.8 IP address
resolvectl status link show global and per-link DNS
resolvect statistics show resolver statistics
resolvectl reset-­sta­tistics reset the statistics
resolvectl flush-­caches flushes all DNS resource record cache
resolvectl reset-­ser­ver­-fe­atures flushes all feature resolver learnt
resolvectl dns ... get/set per-in­terface DNS
resolvectl revert link revert per-in­terface DNS
ln -sf /run/s­yst­emd­/re­sol­ve/­stu­b-r­eso­lv.conf /etc/r­eso­lv.conf provide NSS service

Targets

powero­ff.t­arget shut down and power off the system
rescue.target set up rescue shell
multi-­use­r.t­arget set up non graphical multi user system
graphi­cal.target set up graphical multi user system
reboot.target shutdown and reboot the system
systemctl list-units --type target lists currently loaded target units
systemctl list-units --type target --all lists all loaded target units
systemctl isolate name.t­arget changes the current target
systemctl get-de­fault view default target
systemctl set-de­fault name.t­arget set desired target
systemctl isolate name.t­arget change current to desired target
systemctl rescue change current target and enter rescue mode
systemctl --no-wall rescue change current target and enter rescue mode
systemctl emergency change the current target and enter emergency mode
systemctl --no-wall emergency change the current target and enter emergency mode

Power Management

systemctl halt halts the system
systemctl poweroff powers off the system
systemctl reboot restarts the system
systemctl suspend suspends the system
systemctl hibernate hibernates the system
systemctl hybrid­-sleep hibernates and suspends the system

Login Management

loginctl list-s­essions list current sessions
loginctl sessio­n-s­tatus id show runtime status inform­ation
loginctl show-s­ession id show properties of one or more sessions
loginctl activate id activate a session
loginctl lock-s­ession id activates the screen lock
loginctl unlock­-se­ssion id deacti­vates the screen lock
loginctl termin­ate­-se­ssion id terminates a session
loginctl kill-s­ession id send a signal to one or more processes of the session
loginctl list-users list currently logged in users
loginctl termin­ate­-user user terminates all sessions of a user
loginctl kill-user user send a signal to all processes of a user
loginctl list-seats list currently available seats on the local system

D-Bus Management

busctl list show all peers on the bus, by their service names
busctl status service show process inform­ation and creden­tials of a bus service
busctl monitor service dump messages being exchanged
busctl capture service writes the output in pcap format
busctl tree service shows an object tree of one or more services
   
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          systemd Cheat Sheet
          Journalctl Cheat Sheet

          More Cheat Sheets by misterrabinhalder

          RPM Cheat Sheet