0% found this document useful (0 votes)
6 views2 pages

Tme520 Systemd

This document provides a cheat sheet comparing commands for managing system state and services between SysVinit and Systemd. It outlines commands for controlling system state like rebooting and shutting down, starting and stopping services, and investigating systemd logs and states.

Uploaded by

Pas DEN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Tme520 Systemd

This document provides a cheat sheet comparing commands for managing system state and services between SysVinit and Systemd. It outlines commands for controlling system state like rebooting and shutting down, starting and stopping services, and investigating systemd logs and states.

Uploaded by

Pas DEN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

systemd Cheat Sheet

by TME520 (TME520) via cheatography.com/20978/cs/3849/

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 Systemd command Notes


command

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 systemctl condre​start httpd.s​ervice Restarts if the service is already running.
condre​start
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​‐ Print a list of services showing which runlevels they are
ste​m/*.wants/ 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 -- systemctl daemon​-reload Run this command after a change in any config​uration file
add (old or new).

By TME520 (TME520) Published 8th April, 2015. Sponsored by Readable.com


cheatography.com/tme520/ Last updated 12th May, 2016. Measure your website readability!
tme520.com Page 1 of 2. https://readable.com
systemd Cheat Sheet
by TME520 (TME520) via cheatography.com/20978/cs/3849/

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- View the messages of priority level WARNING or more from a certain
19 23:59:​59" 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.

By TME520 (TME520) Published 8th April, 2015. Sponsored by Readable.com


cheatography.com/tme520/ Last updated 12th May, 2016. Measure your website readability!
tme520.com Page 2 of 2. https://readable.com

You might also like