systemctl
Manage services: start, stop, start at boot
What it does
Services such as nginx, databases or your own app are run by systemd on modern distributions, and you manage them with systemctl. status shows whether a service is running and the latest lines of its log; press q to leave the view.
start, stop and restart start, stop and restart a service, and reload rereads its settings without stopping it, if the service supports that. enable makes it start at boot, and --now also starts it right away. Everything but status needs sudo.
Syntax
systemctl status <service>
sudo systemctl start|stop|restart <service>
sudo systemctl reload <service>
sudo systemctl enable --now <service>Examples
Check whether the nginx service is running
systemctl status nginxsystemctl— manage systemd servicesstatus— the state and the latest log linesnginx— the service
Restart nginx
sudo systemctl restart nginxsudo— needs admin rightsrestart— stop and start againnginx— the service
Make nginx start at boot and start it right now
sudo systemctl enable --now nginxenable— start at system boot--now— and start it right awaynginx— the service
Related commands
- journalctl — Read the logs of services and the system
- ss — Find out which ports are open and who listens on them
- kill — End a process by its ID