GICT knowledge base
How to List Running Services on Linux
Published
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
How to Restrict an SSH Key to One Command
Restrict an SSH key to one command with authorized_keys options. Protect the command and check that unwanted shell and forwarding access are denied.
Linux and CommandsSelf-Hosted Video Processing With FFmpeg: A Practical Guide
Learn how to self-host video processing on a VPS using FFmpeg, with practical commands for conversion, compression, thumbnails, and automated workflows.
Linux and CommandsHow to use nohup: Commands in Linux That Survive Terminal Closes
Keep commands running after you close the terminal. nohup examples with wget, Python, rsync, and Docker on any VPS.
Linux and CommandsHow to Fix “Too Many Open Files” Error on Linux Servers
Learn how to fix the "Too Many Open Files" error on Linux servers by understanding file descriptors, adjusting limits, and diagnosing leaks effectively.
