Most modern Linux distributions use systemd as the default service manager. Knowing how to list running services and check their state is part of routine system work, whether you are debugging a failing web server or confirming a service is enabled at boot.
systemctl is the command-line tool for managing systemd. This guide explains how to use it to list services, filter by state, and inspect service status.
Systemd organizes everything as units. A service unit is a program that runs in the background — nginx, SSH, cron, and so on. Service unit files have a .service extension and are stored as plain text in ini format.
To list all loaded service units that are currently active:
bashsudo systemctl list-units --type service
The output columns are:
By default, only loaded active units are shown. Add --all to include loaded but inactive units:
bashsudo systemctl list-units --type service --all
list-units vs list-unit-files. These answer different questions. list-units shows what is currently loaded in memory. list-unit-files shows all service files installed on disk, whether or not they are currently loaded:
bashsystemctl list-unit-files --type service
The STATE column in the list-unit-files output shows boot enablement:
systemctl start will fail until it is unmaskedUse list-unit-files when you want to check which services are enabled at boot — not list-units.
Filter loaded units by their current state with --state:
bashsystemctl list-units --type service --state=running # running services onlysystemctl list-units --type service --state=failed # failed services onlysystemctl list-units --type service --state=exited # ran once and completed
--state=exited catches oneshot services — services designed to run once at boot and exit cleanly. They are not failed; they are finished. Without this filter they are easy to miss.
To list all failed units across the system:
bashsystemctl --failed
To list only services that are enabled to start at boot:
bashsystemctl list-unit-files --type service --state=enabled
For a full status block with recent log lines:
bashsudo systemctl status nginx.service
The .service suffix is optional. systemctl status nginx produces the same output.
The status block includes: Loaded (unit file path + boot enablement), Active (state and how long the service has been running), Main PID (the main process ID), and CGroup (the control group with all child processes listed).
For quick checks without the full output, two commands return a single word:
bashsystemctl is-active nginx.service # returns: active or inactivesystemctl is-enabled nginx.service # returns: enabled or disabled
Both return exit code 0 for true and non-zero for false. Use --quiet in scripts to suppress the text and check only the exit code:
bashif systemctl is-active --quiet nginx; then echo "Nginx is running"fi
For script-friendly output on listing commands, add --no-pager to prevent systemctl from piping output to a pager:
bashsystemctl list-units --type service --no-pager
When systemctl status shows truncated log lines, run journalctl -u service_name for the full history.
systemctl list-units shows what is running now. systemctl list-unit-files shows what is installed and enabled. Use is-active --quiet in scripts and journalctl -u when you need to dig into failures. Leave a comment below if you run into any issues.