Show Menu

systemd Cheat Sheet by

Systemd : system state, services management, troubleshooting and runlevels.
linux     start     management     services     systemd     stop     restart     sleep     hibernate     investigate     analyze     runlevels

System state

Old command
Systemd command
Desc­rip­tion
halt
systemctl halt
Halts the system.
poweroff
systemctl poweroff
Powers off the system.
reboot
systemctl reboot
Restarts the system.
pm-suspend
systemctl suspend
Suspends the system.
pm-hib­ernate
systemctl hibernate
Hibernates the system.
pm-sus­pen­d-h­ybrid
systemctl hybrid­-sleep
Hibernates and suspend the system.

Services management

SysVinit command
Systemd command
Notes
service httpd start
systemctl start httpd.s­ervice
Start a service (not reboot persis­tent).
service httpd stop
systemctl stop httpd.s­ervice
Stop a service (not reboot persis­tent).
service httpd restart
systemctl restart httpd.s­ervice
Restart a service.
service httpd reload
systemctl reload httpd.s­ervice
Reloads the config­uration files without interr­upting pending operat­ions.
service httpd condre­start
systemctl condre­start httpd.s­ervice
Restarts if the service is already running.
service httpd status
systemctl status httpd.s­ervice
Shows the status of a service.
service --stat­us-all
systemctl list-units --type­=se­rvice
Displays the status of all services.
ls /etc/r­c.d­/in­it.d/
systemctl list-u­nit­-files --type­=se­rvice
List the services that can be started or stopped.
chkconfig httpd on
systemctl enable httpd.s­ervice
Start service at next boot.
chkconfig httpd off
systemctl disable httpd.s­ervice
Service won't be started on next boot.
chkconfig httpd
systemctl is-enabled httpd.s­ervice
Check if a service is configured to start in the current enviro­nment.
chkconfig --list
systemctl list-u­nit­-files --type­=se­rvice or ls /etc/s­yst­emd­/sy­ste­m/*.wants/
Print a list of services showing which runlevels they are configured for.
chkconfig httpd --list
ls /etc/s­yst­emd­/sy­ste­m/*.wa­nts­/ht­tpd.se­rvice
Show which runlevels a service is configured for.
chkconfig httpd --add
systemctl daemon­-reload
Run this command after a change in any config­uration file (old or new).

Invest­igate

Comm­and
Notes
systemctl get-de­fault
Determine which target unit is used by default.
systemctl set-de­fault multi-­use­r.t­arget
Change default boot target to multi-­use­r.t­arget.
journalctl -b
Show all messages from last boot.
journalctl -b -p err
Show all messages of priority level ERROR and more from last boot.
journalctl -p warning --sinc­e="2­015­-07-31 12:34:­56" --unti­l="2­015­-09-19 23:59:­59"
View the messages of priority level WARNING or more from a certain date and time.
journalctl -f
Follow new messages a la tail -f.
journalctl -u SERVICE
Show logs for SERVICE.
journalctl /usr/s­bin­/httpd
Show all messages related to a specific execut­able.
journalctl --full
Display all messages without truncating any.
systemctl --stat­e=f­ailed
Display the services that failed to start.
systemctl list-units --type­=target
Show current runlevel.
systemctl isolate graphi­cal.target
Change the current runlevel (target).
systemctl rescue­/em­ergency
Switch to Rescue (single user)/­Eme­rgency mode.
systemctl kill SERVIC­E.s­ervice
Gently kill SERVICE (SIGT­ERM, 15).
system­d-cgls
Show the full systemd control group (cgroup) hierarchy as a tree.
systemctl show -p "­Wan­ts" multi-­use­r.t­arget
Find out what other units does a unit depend on.
systemctl list-jobs
Show jobs.

Runlevels

SysVinit runlevel
Systemd target
Notes
0
runlev­el0.ta­rget, powero­ff.t­arget
Halt the system.
1, s, single
runlev­el1.ta­rget, rescue.target
Single user mode.
2, 4
runlev­el2.ta­rget, runlev­el4.ta­rget, multi-­use­r.t­arget
User-d­efined runlevels (identical to 3).
3
runlev­el3.ta­rget, multi-­use­r.t­arget
Multi-­user, non-gr­aph­ical.
5
runlev­el5.ta­rget, graphi­cal.target
Multi-­user, graphical.
6
runlev­el6.ta­rget, reboot.target
Rebbot.
emergency
emerge­ncy.target
Emergency shell.

Download the systemd Cheat Sheet

2 Pages
//media.cheatography.com/storage/thumb/tme520_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

          Journalctl Cheat Sheet

          More Cheat Sheets by TME520

          dig Cheat Sheet
          awk Cheat Sheet
          wget Cheat Sheet