Cheatography
https://cheatography.com
Features
Socket-based activation |
Bus-based activation |
Device-based activation |
Path-based activation |
Mount and automount point management |
Aggressive parallelization |
Transactional unit activation logic |
Backwards compatibility with SysV init |
Configuration
/etc/systemd/system.conf override default configuration |
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 hierarchically organized units that manage system processes |
.snapshot A saved state of the systemd manager |
.socket An inter-process communication socket |
.swap A swap device or a swap file |
.timer A systemd timer |
Unit File Locations
/usr/lib/systemd/system/ Systemd unit files distributed with installed packages |
/run/systemd/system/ Systemd unit files created at run time |
/etc/systemd/system/ 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 --since="2012-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/lib/systemd/systemd show all messages by a specific executable |
journalctl _PID=1 show all messages by a specific process |
journalctl -u man-db.service 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_FACILITY=10 show auth.log equivalent by filtering on syslog facility |
journalctl --file /var/log/journal/*/system.journal -f force journalctl to look only into most recent journal |
journalctl --vacuum-size=100M remove archived journal files until the disk space they use falls below 100M |
journalctl --vacuum-time=2weeks make all journal files contain no data older than 2 weeks |
Boot Management
bootctl --path=esp status shows brief information about the system firmware |
bootctl --path=esp install installs systemd-boot into the EFI system partition |
bootctl --path=esp update updates all installed versions of systemd-boot |
bootctl --path=esp remove removes all installed versions of systemd-boot |
bootctl --path=esp list shows all available boot loader entries |
bootctl --path=esp set-default ID sets the default boot loader entry |
Control Group Management
systemd-cgls shows the cgroup hierarchy in a pretty tree |
Device Management
udevadm info options devpath query the udev database for device information |
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
coredumpctl list list core dumps |
coredumpctl info show information about core dump |
coredumpctl dump extract the core dump |
coredumpctl debug invoke debugger on a core dump |
Hostname Management
hostnamectl status show current system hostname and related information |
hostnamectl set-hostname 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-unit-files --type service list all available service units to see if they are enabled |
systemctl status name.service show detailed information about a service unit |
systemctl is-active name.service verify a particular service unit is running |
systemctl is-enabled name.service verify a particular service unit is enabled |
systemctl list-dependencies --after name.service show units ordered to start before a service unit |
systemctl list-dependencies --before name.service show units ordered to start after a service unit |
systemctl start name.service start a service unit |
systemctl stop name.service stop a service unit |
systemctl restart name.service restart a service unit |
systemctl try-restart name.service restart a service unit if corresponding service running |
systemctl reload name.service reload service unit configuration file |
systemctl enable name.service enable service unit |
systemctl reenable name.service reenable service unit |
systemctl disable name.service disable service unit |
systemctl mask name.service mask service unit to prevent from being started |
systemctl unmask name.service unmask a service unit |
systemctl daemon-reload notify new service file exists |
systemd-delta show overridden units |
Locale
localectl status show current status |
localectl list-locales list available locales |
localectl set-locale LANG=locale set new locale |
localectl list-keymaps list available keymaps |
localectl set-keymap map set new keymap |
localectl set-x11-keymap map set console and x11 keymap |
localectl --no-convert set-x11-keymap map set x11 keymap |
Date and Time
timedatectl show current date and time |
timedatectl set-time HH:MM:SS change current time |
timedatectl set-local-rtc boolean set clock in local time |
timedatectl set-time YYYY-MM-DD change current date |
timedatectl list-timezones list all available time zones |
timedatectl set-timezone time_zone set new timezone |
timedatectl set-ntp boolean set or unset NTP service |
Container Management
systemd-nspawn -b -D /path/to/os/tree run OS in a namespace container |
systemd-nspawn -b -D /path/to/os/tree -M machine_name --network-bridge=bridge_name run OS in a namespace container |
Ctril+]]] kill the container from inside |
machinectl list list currently running containers |
machinectl status machine_name show runtime status information about the container |
machinectl show machine_name show properties about the container |
machinectl start machine_name start container as a system service by the name in /var/lib/machines/ |
machinectl login machine_name open an interactive terminal login session in container |
machinectl shell opean an interactive shell session in a container |
machinectl enable machine_name enable a container as a system service |
machinectl disable *machine_name disable a container as a system service |
machinectl reboot machine_name reboot a container |
machinectl terminate machine_name terminates a container |
machinectl kill machine_name send a signal to processes of the container |
machinectl bind machine_name host_path container_path bind mounts from the host into the container |
machinectl copy-to machine_name host_path container_path copies from the host into a running container |
machinectl copy-from machine_name container_path host_path copies from container into the host system |
|
|
Network Management
networkctl list show list of links |
networkctl status link show information about specified link |
networkctl lldp link show LLDP neighbors |
networkctl label show numerical address labels |
systemctl start systemd-networkd.service start systemd-networkd daemon |
systemctl enable systemd-networkd.service start systemd-networkd daemon at boot |
Domain Name Management
systemctl start systemd-resolvd.service start systemd-resolved daemon |
systemctl enable systemd-resolved.service start systemd-resolved daemon at boot |
resolvectl query www.example.com show the address of the www.example.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-statistics reset the statistics |
resolvectl flush-caches flushes all DNS resource record cache |
resolvectl reset-server-features flushes all feature resolver learnt |
resolvectl dns ... get/set per-interface DNS |
resolvectl revert link revert per-interface DNS |
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf provide NSS service |
Targets
poweroff.target shut down and power off the system |
rescue.target set up rescue shell |
multi-user.target set up non graphical multi user system |
graphical.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.target changes the current target |
systemctl get-default view default target |
systemctl set-default name.target set desired target |
systemctl isolate name.target 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-sessions list current sessions |
loginctl session-status id show runtime status information |
loginctl show-session id show properties of one or more sessions |
loginctl activate id activate a session |
loginctl lock-session id activates the screen lock |
loginctl unlock-session id deactivates the screen lock |
loginctl terminate-session id terminates a session |
loginctl kill-session id send a signal to one or more processes of the session |
loginctl list-users list currently logged in users |
loginctl terminate-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 information and credentials 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 |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by misterrabinhalder