Show Menu

Systemd Cheat Sheet by

systemd     init

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­/sy­ste­md/­sys­tem.conf override default config­uration

Unit Types

.ser­vice A system service
.tar­get A group of systemd units
.aut­omo­unt A file system automount point
.dev­ice 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
.sna­pshot A saved state of the systemd manager
.soc­ket An inter-­process commun­ication socket
.swap A swap device or a swap file
.timer A systemd timer

Unit File Locations

/usr­/li­b/s­yst­emd­/sy­stem/ Systemd unit files distri­buted with installed packages
/run­/sy­ste­md/­sys­tem/ Systemd unit files created at run time
/etc­/sy­ste­md/­sys­tem/ Systemd unit files for extending a service

Logs

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

syst­emd­-cgls shows the cgroup hierarchy in a pretty tree

Device Management

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

Coredump Management

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

Hostname Management

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

Services

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

Locale

loca­lectl status show current status
loca­lectl list-l­oca­les list available locales
localectl set-locale LANG=­loc­ale set new locale
loca­lectl list-k­eym­aps list available keymaps
loca­lectl set-keymap map set new keymap
loca­lectl set-x1­1-k­eymap map set console and x11 keymap
loca­lectl --no-c­onvert set-x1­1-k­eymap map set x11 keymap

Date and Time

time­dat­ectl show current date and time
time­datectl set-time HH:MM­:SS change current time
time­datectl set-lo­cal-rtc boole­an set clock in local time
time­datectl set-time YYYY-­MM-­DD change current date
time­datectl list-t­ime­zones list all available time zones
time­datectl set-ti­mezone time_­zone set new timezone
time­datectl set-ntp boole­an set or unset NTP service

Container Management

syst­emd­-nspawn -b -D /path­/to­/os­/tr­ee run OS in a namespace container
syst­emd­-nspawn -b -D /path­/to­/os­/tree -M machi­ne_­name --netw­ork­-br­idg­e=­bri­dge­_na­me run OS in a namespace container
Ctri­l+]]] kill the container from inside
mach­inectl list list currently running containers
mach­inectl status machi­ne_­name show runtime status inform­ation about the container
mach­inectl show machi­ne_­name show properties about the container
mach­inectl start machi­ne_­name start container as a system service by the name in /var/l­ib/­mac­hines/
mach­inectl login machi­ne_­name open an intera­ctive terminal login session in container
mach­inectl shell opean an intera­ctive shell session in a container
mach­inectl enable machi­ne_­name enable a container as a system service
mach­inectl disable *machi­ne_­name disable a container as a system service
mach­inectl reboot machi­ne_­name reboot a container
mach­inectl terminate machi­ne_­name terminates a container
mach­inectl kill machi­ne_­name send a signal to processes of the container
mach­inectl bind machi­ne_­name host_­path conta­ine­r_p­ath bind mounts from the host into the container
mach­inectl copy-to machi­ne_­name host_­path conta­ine­r_p­ath copies from the host into a running container
mach­inectl copy-from machi­ne_­name conta­ine­r_path host_­path copies from container into the host system
 

Network Management

netw­orkctl list show list of links
netw­orkctl status link show inform­ation about specified link
netw­orkctl lldp link show LLDP neighbors
netw­orkctl label show numerical address labels
syst­emctl start system­d-n­etw­ork­d.s­erv­ice start system­d-n­etworkd daemon
syst­emctl enable system­d-n­etw­ork­d.s­erv­ice start system­d-n­etworkd daemon at boot

Domain Name Management

syst­emctl start system­d-r­eso­lvd.se­rvice start system­d-r­esolved daemon
syst­emctl enable system­d-r­eso­lve­d.s­erv­ice start system­d-r­esolved daemon at boot
reso­lvectl query www.e­xam­ple.com show the address of the www.e­xam­ple.com domain
reso­lvectl query 8.8.8.8 show the domain of the 8.8.8.8 IP address
reso­lvectl status link show global and per-link DNS
reso­lvect statis­tics show resolver statistics
reso­lvectl reset-­sta­tis­tics reset the statistics
reso­lvectl flush-­cac­hes flushes all DNS resource record cache
reso­lvectl reset-­ser­ver­-fe­atu­res flushes all feature resolver learnt
reso­lvectl dns ... get/set per-in­terface DNS
reso­lvectl 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.c­onf provide NSS service

Targets

powe­rof­f.t­arget shut down and power off the system
resc­ue.t­ar­get set up rescue shell
mult­i-u­ser.ta­rget set up non graphical multi user system
grap­hic­al.t­ar­get set up graphical multi user system
rebo­ot.t­ar­get shutdown and reboot the system
syst­emctl list-units --type target lists currently loaded target units
syst­emctl list-units --type target --all lists all loaded target units
syst­emctl isolate name.t­ar­get changes the current target
syst­emctl get-de­fault view default target
syst­emctl set-de­fault name.t­ar­get set desired target
syst­emctl isolate name.t­ar­get change current to desired target
syst­emctl rescue change current target and enter rescue mode
syst­emctl --no-wall rescue change current target and enter rescue mode
syst­emctl emerge­ncy change the current target and enter emergency mode
syst­emctl --no-wall emerge­ncy change the current target and enter emergency mode

Power Management

syst­emctl halt halts the system
syst­emctl poweroff powers off the system
syst­emctl reboot restarts the system
syst­emctl suspend suspends the system
syst­emctl hibern­ate hibernates the system
syst­emctl hybrid­-sl­eep hibernates and suspends the system

Login Management

loginctl list-s­ess­ions 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-u­sers 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-s­eats 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 servi­ce show process inform­ation and creden­tials of a bus service
busctl monitor servi­ce dump messages being exchanged
busctl capture servi­ce writes the output in pcap format
busctl tree servi­ce shows an object tree of one or more services

Download the Systemd Cheat Sheet

3 Pages
//media.cheatography.com/storage/thumb/misterrabinhalder_systemd.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

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