To manage a service on a modern Linux system you use systemctl, and a handful of verbs cover the job. systemctl status nginx tells you whether it is running and shows the last few log lines; sudo systemctl restart nginx bounces it; sudo systemctl enable --now nginx starts it and sets it to come back after a reboot. The piece people trip on is that start and enable are different: start runs it now, enable makes it survive a reboot, and --now does both at once. When a service refuses to come up, journalctl -u nginx shows you why. Here's each command, the start-versus-enable trap, and how to read the logs when something will not start.
The short answer
systemctl status name checks it, sudo systemctl restart name bounces it,
sudo systemctl enable --now name starts it and makes it survive reboots.
journalctl -u name shows the logs when it will not start.
Check a service
systemctl status nginx Green active (running) is what you want. The command also tails the last log
lines, so a failure usually explains itself right here.
Start, stop, restart, reload
sudo systemctl restart nginx start and stop do what they say. For a config change, prefer reload,
which re-reads the config without dropping connections.
Enable at boot, the part people miss
sudo systemctl enable --now nginx start runs it now but does not survive a reboot. enable makes it launch at
boot but does not start it this second. --now does both, which is almost
always what you actually meant.
Read the logs when it won’t start
journalctl -u nginx -n 50 -u scopes it to one service, -n 50 shows the last 50 lines, and -f
follows new entries live while you reproduce the problem.
Frequently asked questions
What is the difference between start and enable?
start runs the service right now but forgets it after a reboot. enable sets it to launch automatically at boot but does not start it this instant. You usually want both, which is exactly what "sudo systemctl enable --now name" does.
How do I see why a service failed to start?
Read its logs with "journalctl -u name". Add -n 50 for the last 50 lines or -f to follow live. The status command, "systemctl status name", also prints the last few lines, which is often all you need.
Do I need sudo for systemctl?
For status and the is-active or is-enabled checks, no. For anything that changes state (start, stop, restart, enable, disable), yes, because you are altering a system service. Reading is free, changing needs sudo.
What is the difference between restart and reload?
restart stops and starts the service, dropping current connections for a moment. reload tells it to re-read its config without a full stop, when the service supports it (nginx does). Use reload for a config change, restart when reload is not enough.