Unix Services

Managing services in Unix.

For specific services, see Ports & Protocols.

Start a service

The service command is a wrapper over init.d scripts. To get more granular control of services, use tools such as rcconf or sysv-rc-conf.

Examples of service names: ssh, mysql, apache2

sudo service service_name start
sudo systemctl start service_name
sudo /etc/init.d/service_name start

Stop a service

sudo service service_name stop
sudo systemctl stop service_name
sudo /etc/init.d/service_name stop

Service status

sudo netstat -antp | grep service_name
sudo ss -antpl | grep service_name
sudo service service_name status
sudo systemctl status service_name
sudo /etc/init.d/service_name status

Restart a service

sudo service service_name restart
sudo systemctl restart service_name
sudo /etc/init.d/service_name restart

Start services at boot time

Have services start automatically at boot time.

sudo systemctl enable service_name
sudo update-rc.d service_name enable

List all available services

systemctl list-unit-files