Ubuntu – How to stop all services

services

I'm looking for a command to stop all services running and probably restart them after.
Any help would be appreciated.

Best Answer

assuming you are using ubuntu 16.04 you can use systemctl to control services.

to get a list of services and their status

systemctl | grep service

to control an individual service , replace service with the service name

systemctl status service
systemctl stop service
systemctl start service

in older version of ubuntu services can be controlled via init scripts which live in /etc/init.d , these work in a similar way

to get a list of services

ls -l /etc/init.d/

to contrl and individual service

/etc/init.d/service status
/etc/init.d/service stop
/etc/init.d/service start