Mastering Service Discovery: How to List All Running and Available Services on Linux
Forget the generic systemctl list-units
— let's uncover the full spectrum of Linux services using a combination of lesser-known commands and techniques that reveal hidden layers of system activity and potential vulnerabilities.
Why Comprehensive Service Discovery Matters
When managing Linux systems, knowing exactly what services are running or available is fundamental—not just for keeping things organized but also for troubleshooting issues, optimizing performance, and fortifying security. Services can run in various ways; some are managed via systemd
, others might spawn from legacy init scripts, and still others may run as standalone processes.
A narrow focus on one command or interface risks missing important processes and services that could be consuming resources or introducing security risks.
The Basics: systemctl
and Its Limits
The go-to tool in many modern Linux distros is systemctl
, part of systemd
. To list active services, you might run:
systemctl list-units --type=service --state=running
This displays all currently running systemd-managed services. For all available (loaded) services regardless of state:
systemctl list-unit-files --type=service
However, this covers only those services registered with systemd.
Digging Deeper: Other Service Managers and Legacy Scripts
1. SysVinit Services
Some systems or certain backward compatibility setups still include Init scripts located in /etc/init.d/
. To list these services:
ls /etc/init.d/
Check their status (if supported) by running:
service <service-name> status
To see which SysVinit services are set to start at various runlevels, use:
chkconfig --list
Note:
chkconfig
is more common on older RPM-based systems like CentOS 6.
2. Upstart Services
On older Ubuntu versions (pre-15.04), Upstart was used instead of systemd. You can list jobs with:
initctl list
If you need to support a variety of distros or legacy systems, checking for the presence and type of init system helps:
ps -p 1 -o comm=
If output is systemd
, you know what manager you're dealing with; if it’s init
or upstart
, adjust your commands accordingly.
Finding Services From Running Processes
Not all services appear as formal units or scripts. Some daemons might run as standalone processes launched manually or at boot via crontabs.
Use ps
combined with searching commands:
ps aux | grep -Ei 'daemon|service|httpd|nginx|mysql|ssh'
Example:
ps aux --sort=start_time | less
This lets you eyeball which long-running processes are active. To automate detecting daemons from running processes, check for known service binaries in /usr/sbin
, /usr/bin
, etc.
Using netstat
and ss
to Detect Network Services
Many critical services open network ports. You can find these listening sockets to identify running network daemons.
With netstat
(might require installing net-tools):
sudo netstat -tulnp
Or better, with newer tooling:
sudo ss -tulnp
Sample output columns show the service’s PID/Program name, helping pinpoint which service is bound to each port.
Inspecting Services Enabled at Boot
To see what will start on boot under systemd:
systemctl list-unit-files --state=enabled --type=service
For SysVinit-based systems, inspect runlevel directories:
ls /etc/rc*.d/
You can check symbolic links starting with S
(start) versus those starting with K
(kill/stop).
Example: Discovering All Services on a Fedora System
Let’s put it all together:
-
List running systemd services:
sudo systemctl list-units --type=service --state=running
-
View all loaded unit files (installed services):
sudo systemctl list-unit-files --type=service
-
Check for legacy init scripts (may still exist):
ls /etc/init.d/
-
Detect network listeners potentially representing services:
sudo ss -tulnp | less
-
Quickly identify daemons launched manually or outside of init managers:
ps aux | grep -i 'daemon'
Wrapping Up: Why This Matters for Security and Performance
A fully-informed administrator knows all active components on a machine: hidden daemons can drain resources or provide attack vectors if unnoticed.
Regularly auditing your running and available services ensures you’re not caught off guard by rogue applications or outdated software consuming CPU/memory unnecessarily.
Mastering Linux service discovery transforms maintenance from guesswork into precise control—a key skill for any sysadmin or developer working in server environments.
Ready to uncover your own system’s hidden layers? Start exploring beyond the default commands today!
If you found this guide useful, follow me for more deep dives into Linux system management!