Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

How to List Running Services on Linux

Published

Linux and Commands

On a Linux server that uses systemd, list services that are running now with:

systemctl list-units --type=service --state=running --no-pager

This is different from listing programs or services configured to start at boot. The following read-only commands answer those separate questions:

# Loaded service units, including inactive ones
systemctl list-units --type=service --all --no-pager

# Installed service unit files and their enablement state
systemctl list-unit-files --type=service --no-pager

# Units in a failed state
systemctl --failed --no-pager

Inspect one service

Replace nginx.service with a unit name from the list. A service does not need to be restarted to inspect it:

systemctl status nginx.service --no-pager
journalctl -u nginx.service -n 50 --no-pager

Access to some logs requires administrator privileges. Remove credentials, customer data, and access tokens before sharing log output in a support ticket. A nonzero exit status from systemctl status can indicate an inactive or missing service rather than a problem with the command itself.

What about pstree?

pstree displays a hierarchy of processes. It can help explain which program started another program, but it is not a list of service definitions or their boot settings. Similarly, a service marked active (exited) may have completed a one-time task successfully without a continuously running process.

If you see an error that the system was not booted with systemd, use the service manager provided by that environment. Containers, recovery shells, and some Linux distributions do not run systemd as their init system.

Reference: systemctl manual.

Related guides

Account services are unavailable until the production backend is configured.