Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
92 views

Systemd Cheatsheet

This document provides a cheatsheet comparing commands for managing services and system states between SysV init and systemd. It lists the equivalent commands for starting, stopping, restarting, checking status of services, enabling or disabling services at boot, and checking and changing the system runlevel or target unit. Additional systemd-specific commands are also included for managing logs, checking for failed units, listing targets and jobs, and changing power states.

Uploaded by

Susant Sahani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views

Systemd Cheatsheet

This document provides a cheatsheet comparing commands for managing services and system states between SysV init and systemd. It lists the equivalent commands for starting, stopping, restarting, checking status of services, enabling or disabling services at boot, and checking and changing the system runlevel or target unit. Additional systemd-specific commands are also included for managing logs, checking for failed units, listing targets and jobs, and changing power states.

Uploaded by

Susant Sahani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Systemd Cheatsheet

Sysvinit Command Systemd Command Notes


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

You might also like