SysVInit/SystemD Cheat Sheet

sysvinit command systemd command notes
service sshd start systemctl start sshd Start the sshd service
service sshd stop systemctl stop sshd Stop the sshd service
service sshd restart systemctl restart sshd Restart the sshd service
service sshd reload systemctl reload sshd Reload the sshd service
service sshd condrestart systemctl condrestart sshd Restarts sshd if it’s already running
service sshd status systemctl status sshd Check the status of sshd
chkconfig –list systemctl list-unit-files –type=service List all services and their status
chkconfig sshd on systemctl enable sshd Enable the sshd service
chkconfig sshd off systemctl disable sshd Disable the sshd service
chkconfig –list sshd ls /etc/systemd/system/*.wants/sshd.service Show all runlevels/targets sshd is enabled in
chkconfig –add sshd systemctl daemon-reload Used to create new service files

sysvinit service scripts are stored in /etc/init.d or /etc/rc.d/init.d and have no extension.

systemd service files are stored in /etc/systemd/system/*.wants directories. Service files need to have a .service extension.


sysvinit runlevel systemd target name notes
0 runlevel0, poweroff Shut down and power off the system
1 runlevel1, rescue Setup rescue shell
2, 3, 4 runelevel2, runlevel3, runlevel4, multi-user Non-graphical multi-user
5 runlevel5, graphical Graphical multi-user
6 runlevel6, reboot Reboot the system


sysvinit systemd notes
runlevel systemctl list-units –type target List runlevels
cat /etc/inittab systemctl get-default Default runlevel
telinit <runlevel#> systemctl isolate <name>.target Change the runlevel
nano or vi /etc/inittab systemctl set-default <name>.target Change the default runlevel