Ask Steves · Daily notes · VPS, 20% off · AI Profit Lab · SEO · Money Hub

19 September 2026 · One command a day

How do I check if a service is running on Linux?

The systemctl status command tells you whether a service is running, how long it has been up, and if it has stopped, what it said on the way out. You reach for it the moment a site goes dark and you want to know if nginx, a database or a Docker daemon is still alive. It works for anything managed by systemd, which on Ubuntu is nearly everything that starts at boot.

The command

sudo systemctl status nginx

systemctl is the tool for talking to systemd, the service manager on Ubuntu 24.04. status asks for a report rather than making any change. nginx is the unit name. You can write nginx.service in full, but the suffix is optional. The sudo is not required to see the state, but without it you may not see the recent log lines at the bottom, which are often the useful part. Swap nginx for docker, postgresql, ssh or any other service name.

What you will see

× nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Fri 2026-09-19 09:41:12 UTC; 2min 8s ago
   Duration: 3h 29min
       Docs: man:nginx(8)
    Process: 4120 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
        CPU: 21ms

Sep 19 09:41:12 host systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server...
Sep 19 09:41:12 host nginx[4120]: nginx: [emerg] unexpected "}" in /etc/nginx/sites-enabled/example.com:14
Sep 19 09:41:12 host nginx[4120]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 19 09:41:12 host systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Sep 19 09:41:12 host systemd[1]: nginx.service: Failed with result 'exit-code'.
Sep 19 09:41:12 host systemd[1]: Failed to start nginx.service - A high performance web server and a reverse proxy server.

The Active line is the one to read first. A healthy service shows active (running) with a green dot. Here it shows failed with a red cross, along with the time it went down. Loaded tells you where the unit file lives and whether the service is enabled, meaning it will start at boot. Main PID appears when the service is up and gives you the process number. The log lines at the bottom are the last ten entries from the journal. In this example they say exactly what went wrong: a stray brace on line 14 of a site config. That is why you should test your nginx config before reloading it.

When to use it

Watch out for

When the output is longer than your terminal, systemctl hands it to a pager. Your prompt seems to vanish and typing does nothing. Press q to get out. If you are running the command from a script, or you just prefer plain output, add --no-pager. Also remember that the log tail is only ten lines. If the cause is further back, read the service's logs for the last hour instead.

Questions people ask

What is the difference between active and enabled?

active means the service is running right now. enabled means systemd will start it at boot. A service can be enabled but stopped, or running but disabled, so check both lines.

What does inactive (dead) mean?

The service is not running and did not crash. Either it was stopped on purpose, or it has never been started since boot. Compare that with failed, which means it tried and something went wrong.

On shared hosting you cannot see any of this. You only find out a service died when the site does. On a server you control, the answer is one command away. You can get the same VPS with 20% off at https://asksteves.co.uk/vps. Affiliate link.

Everything on this blog runs on one Hostinger KVM 8. This link takes 20% off the same box.

GET A VPS, 20% OFF →

Affiliate link.

More daily notes: How do I read a service's logs for the last hour on Linux? · How do I watch CPU and memory per process on Linux? · How do I check memory usage on a Linux server?