Systemd Command Cheat Sheet

Systemd is becoming the default on most distros Systemd is becoming the default in many distros, RHEL, CentOS, Ubuntu.

it offers a single command to manage your system, instead of switching between chkconfig or running init scripts.

Systemd Service Commands

systemctl stop service-namesystemd stop running service
systemctl start service-namesystemctl start service
systemctl restart service-namesystemd restart running service
systemctl reload service-namereloads all config files for service
systemctl status service-namesystemctl show if service is running
systemctl enable service-namesystemctl start service at boot
systemctrl disable service-namesystemctl – disable service at boot
systemctl show service-nameshow systemctl service info
systemctl -H target command service-namerun systemctl commands remotely

Systemd Information Commands

Systemd commands that show useful system information.

systemctl list-dependenciesshow and units dependencies
systemctl list-socketssystemd list sockets and activities
systemctl list-jobsview active systemd jobs
systemctl list-unit-filessystemctl list unit files and their states
systemctl list-unitssystemctl list default target (like run level)

Changing System State

systemd reboot, shutdown, default target etc

systemctl rebootsystemctl reboot the system
systemctl poweroffsystemctl shutdown (power off the system)
systemctl emergencyPut in emergency mode
systemctl defaultsystemctl default mode

##Systemctl Viewing Log Messages

journalctlshow all collected log messages
journalctl -u sshd.servicesee sshd service messages
journelctl -ffollow messages as they appear
journelctl -kshow kernel messages only