Systemd Cheatsheet
Systemd Cheatsheet
Sysvinit Command
service httpd start
service httpd stop
service httpd restart
service httpd reload
service httpd condrestart
service httpd status
service --status-all
ls /etc/rc.d/init.d/
chkconfig httpd on
chkconfig httpd off
chkconfig httpd
chkconfig --list
chkconfig httpd --list
chkconfig httpd --add
Systemd Command
systemctl start httpd.service
systemctl stop httpd.service
systemctl restart httpd.service
systemctl reload httpd.service
Notes
Used to start a service (not reboot persistent).
Used to stop a service (not reboot persistent).
Used to stop and then start a service.
When supported, reloads the config file without
interrupting pending operations.
systemctl condrestart httpd.service
Restarts if the service is already running.
systemctl status httpd.service
Tells whether a service is currently running.
systemctl list-units --type service
Displays the status of all services.
systemctl list-unit-files --type=service
Used to list the services that can be started or
stopped. Used to list all the services and other
units.
systemctl enable httpd.service
Turn the service on, for start at next boot, or other
trigger.
systemctl disable httpd.service
Turn the service off for the next reboot, or any
other trigger.
systemctl is-enabled httpd.service
Used to check whether a service is configured to
start or not in the current environment.
systemctl list-unit-files --type=service
Print a table of services that lists which runlevels
ls /etc/systemd/system/*.wants/
each is configured on or off.
ls /etc/systemd/system/*.wants/httpd.service Used to list what levels this service is configured
on or off.
systemctl daemon-reload
Used when you create a new service file or modify
any configuration.
Sysvinit Runlevel
0
1, s, single
2, 4
3
Systemd Target
runlevel0.target, poweroff.target
runlevel1.target, rescue.target
runlevel2.target, runlevel4.target, multi-user.target
runlevel3.target, multi-user.target
runlevel5.target, graphical.target
6
emergency
runlevel6.target, reboot.target
emergency.target
Command
systemctl get-default
systemctl set-default multi-user.target
journalctl -b
journalctl -b -p err
journalctl -p warning --since="2014-06-14 23:59:59"
journalctl -f
journalctl -u SERVICE
journalctl /usr/sbin/httpd
journalctl --full
systemctl --state=failed
systemctl list-units --type=target
systemctl isolate graphical.target
systemctl rescue/emergency
systemctl kill SERVICE.service
systemctl --failed
systemd-cgls
systemctl show -p "Wants" multi-user.target
systemctl list-jobs
Old Command
halt
poweroff
reboot
pm-suspend
pm-hibernate
pm-suspend-hybrid
Notes
Halt the system.
Single user mode.
User-defined/Site-specific runlevels - identical to 3.
Multi-user, non-graphical. Users can usually login via
multiple consoles or via the network.
Multi-user, graphical. Usually has all the services of runlevel 3 plus a graphical login.
Reboot
Emergency shell
Notes
Determine which target unit is used by default.
Change default boot target to multi-user.target.
Show all messages from this boot.
Show all messages of priority levels ERROR (4) and worse, from the
current boot.
View the warning or higher priority messages from certain point in time.
Follow new messages.
Show only log of SERVICE.
Show all messages by a specific executable.
Display full (= not truncated) messages.
Lets find the systemd services which fail to start.
Show current runlevel.
Changes the current target (runlevel).
Changing to Rescue(single user mode)/Emergency Mode.
Kill SERVICE (all processes) with SIGTERM.
List failed services on boot.
cgroup tree
What other units does a unit depend on?
Check for possibly stuck jobs use.
Systemd Command
systemctl halt
systemctl poweroff
systemctl reboot
systemctl suspend
systemctl hibernate
systemctl hybrid-sleep
Description
Halts the system.
Powers off the system.
Restarts the system.
Suspends the system.
Hibernates the system.
Hibernates and suspends the system.