Quick and dirty systemvinit vs systemd vs upstart cheatsheet

Tags: linux, upstart, runlevel, systemctl, service, sysvinit, systemd
Publish Date: 2016-05-13

Quick and dirty cheatsheet

 

systemVinit

systemd

upstart

Start a service

service <name> start

systemctl start <name>

service <name> start

Stop a service

service <name> stop

systemctl stop <name>

service <name> stop

Enable service at startup

chkconfig <name> on

 

chkconfig <name> --level 2,3

systemctl enable <name>

update-rc.d <name> enable

 

update-rc.d <name> enable 2 3

 

 

Disable service at startup

chkconfig <name> off

systemctl disable <name>

update-rc.d <name> disable

Set default runlevel

Edit in /etc/inittab

 

id:<runlevel>:initdefault:

systemctl set-default <name.target>

Edit in /etc/init/rc-sysinit.conf

 

env DEFAULT_RUNLEVEL=2

Get default runlevel

Read from /etc/inittab

 

id:<runlevel>:initdefault:

systemctl get-default

Read from

/etc/init/rc-sysinit.conf

Set current runlevel

init <number>

telinit <number>

systemctl isolate <name.target>

init <number>

telinit <number>

Get current runlevel

runlevel

who -r

runlevel

who -r

runlevel

who -r