SysV/Upstart/Systemd/Launchd are service managers

Common Commands

Command Description

SysV and Upstart

Systemd

Launchd

reload updated services

systemctl daemon-reload

launchctl load ~/path/com.example.plist

list all services

service —status-all

systemctl list-units —type=service
systemctl —type=service

launchctl list

list all active services

systemctl list-units —type=service —state=active
systemctl —type=service —state=active

list all running services

systemctl list-units —type=service —state=running systemctl —type=service —state=running

start a service

service dummy start

systemctl start dummy.service

launchctl start com.example.app

stop a service

service dummy stop

systemctl stop dummy.service

launchctl stop com.example.app

restart a service

service dummy restart

systemctl restart dummy.service

reload a service

service dummy reload

systemctl reload dummy.service

service status

service dummy status

systemctl status dummy.service

restart a service if already running

service dummy condrestart

systemctl condrestart dummy.service

enable service at startup

chkconfig dummy on

systemctl enable dummy.service

launchctl load -w ~/path/com.example.plist

disable service at startup

chkconfig dummy off

systemctl disable dummy.service

launchctl unload -w ~/path/com.example.plist

check if a service is enabled at startup

chkconfig dummy

systemctl is-enabled dummy.service

create a new service file or modify configuration

chkconfig dummy —add

systemctl daemon-reload

Miscellaneous Commands

Command Description

SysV and Upstart

Systemd

system halt

halt

systemctl halt

power off the system

poweroff

systemctl poweroff

restart the system

reboot

systemctl reboot

suspend the system

pm-suspend

systemctl suspend

hibernate

pm-hibernate

systemctl hibernate

follow the system log file

tail -f /var/log/messages

tail -f /var/log/syslog

journalctl -f

Systemd New Commands

Command Description

Systemd

execute a systemd command on remote host

systemctl dummy.service start -H user@host

check boot time

systemd-analyze, systemd-analyze time

kill all processes related to a service

systemctl kill dummy

get logs for events for today

journalctl —since=today

hostname and other host related information

hostnamectl

date and time of system with timezone and other information

timedatectl