logo

service

Last Updated: 2022-08-14

service is used to run an init script in /etc/init.d.

$ sudo service <your_service> {start, stop, restart, status}

For example,

$ sudo service docker start

will run the script /etc/init.d/docker and start dockerd. To check the status:

$ service docker status

To check status of all the services:

$ service --status-all
...
[ + ] cgroupfs-mount
[ - ] docker
[ ? ] networking
...

where [ + ] means the service is running, [ - ] is stopped, [ ? ] means status is not implemented.

service is an "high-level" command used for starting and stopping services in different unixes and linuxes. Depending on the "lower-level" service manager, service redirects on different binaries.

systemctl is similar to service but more powerful. In some systems service will redirect to use systemctl.