Systemd Cheat Sheet
Total Page:16
File Type:pdf, Size:1020Kb
systemd VIEWING systemd INFORMATION systemctl list-dependencies Show a unit’s dependencies Cheat systemctl list-sockets List sockets and what activates Sheet systemctl list-jobs View active systemd jobs systemctl list-unit-files See unit files and their states systemctl list-units Show if units are loaded/active systemctl get-default List default target (like run level) WORKING WITH SERVICES systemctl stop service Stop a running service systemctl start service Start a service systemctl restart service Restart a running service systemctl reload service Reload all config files in service systemctl daemon-reload Must run to reload changed unit files systemctl status service See if service is running/enabled systemctl --failed Shows services that failed to run systemctl reset-failed Resets any units from failed state systemctl enable service Enable a service to start on boot systemctl disable service Disable service--won’t start at boot systemctl show service Show properties of a service (or other unit) systemctl edit service Create snippit to drop in unit file systemctl edit --full service Edit entire unit file for service systemctl -H host status network Run any systemctl command remotely CHANGING SYSTEM STATES systemctl reboot Reboot the system (reboot.target) systemctl poweroff Power off the system (poweroff.target) systemctl emergency Put in emergency mode (emergency.target) systemctl default Back to default target (multi-user.target) RHEL_482736_1118 VIEWING LOG MESSAGES journalctl Show all collected log messages Copyright © 2018 Red Hat, Inc. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, and JBoss journalctl -u network.service See network service messages are trademarks of Red Hat, Inc., registered in the U.S. and other journalctl -f Follow messages as they appear countries. Linux® is the registered trademark of Linus Torvalds in the journalctl -k Show only kernel messages U.S. and other countries. USING UNIT FILES Besides services, most systemd commands can work with these unit types: paths, slices, snapshots, sockets, swaps, targets, and timers.