systemctl

systemctl command is will replace service command (SysV) used in older versions of CentOS/Ubuntu.

To see list of all services, run

systemctl

To view cgroups tree, run

systemd-cgls

To see status of a service

systemctl status SERVICE-NAME

systemctl-service

To start/stop/restart a service

To start

systemctl start SERVICE-NAME

To stop

systemctl stop SERVICE-NAME

To restart

systemctl restart SERVICE-NAME

Enable a service to start on boot

systemctl enable SERVICE-NAME

Service File Location

systemctl service files are located in folder

/etc/systemd/system
/usr/lib/systemd/system

For example mariadb.service file located in folder

/usr/lib/systemd/system/mariadb.service

Show all services that start on boot

To see all services that are enabled (start on system boot).

systemctl list-unit-files | grep enabled

Posted in Linux