How to List Running Services on Linux: A Complete Guide for All Init Systems
Introduction
Linux services are background processes that run continuously to perform system tasks, such as managing networks, handling user logins, or running web servers. These services can be managed through various tools, depending on the Linux distribution and init system in use.
Knowing how to list running services is essential for system administrators and developers. It helps with:
- Troubleshooting issues – Checking if a critical service is running or has failed.
- Performance monitoring – Identifying resource-heavy services.
- Security auditing – Ensuring only necessary services are active.
Using systemctl (For Systemd-Based Systems)
Most modern Linux distributions, including Ubuntu (16.04+), CentOS (7+), Fedora, and Debian (8+), use systemd as the init system. The systemctl
command is the primary tool for managing and listing services in these systems.
Checking the Status of a Single Service
To check if a specific service is running, use:
systemctl status <service-name>
For example, to check if the nginx web server is running:
systemctl status nginx
The output will show whether the service is active (running), inactive, or failed, along with logs for debugging.
Listing All Active Services
To list all running services, use:
systemctl list-units --type=service --state=running
This command displays a table of all currently running services along with their status.
Listing All Services (Including Inactive Ones)
If you want to see all services, regardless of whether they are running or not:
systemctl list-units --type=service
This will include services that are active, inactive, failed, or in other states.
Filtering Services by State
You can filter services based on their state using:
systemctl list-units --type=service --state=failed
This will list only failed services, which can be useful for troubleshooting.
Listing Services Enabled at Boot
To check which services are set to start automatically at boot:
systemctl list-unit-files --type=service | grep enabled
Example Output
A typical output of systemctl list-units --type=service --state=running
might look like this:
UNIT LOAD ACTIVE SUB DESCRIPTION
cron.service loaded active running Regular background program processing daemon
networking.service loaded active running Raise network interfaces
ssh.service loaded active running OpenBSD Secure Shell server
systemd-logind.service loaded active running Login Service
Summary
- Use
systemctl status <service>
to check the status of a single service. - Use
systemctl list-units --type=service --state=running
to list active services. - Use
systemctl list-units --type=service
to see all services. - Use
systemctl list-unit-files --type=service
to view services enabled at boot.
Using ps and grep for Running Processes
If you want to list running services without relying on systemctl
or other service management tools, you can use ps (process status) along with grep to find specific processes.
This method is useful when:
- You are working on a minimal Linux system that lacks
systemctl
orservice
commands. - You want to check if a specific process is running, regardless of the init system.
Listing All Running Processes
The ps aux
command displays all running processes on the system:
ps aux
This will produce an extensive list of all running processes, including their process IDs (PIDs), CPU usage, memory usage, and command names.
Searching for a Specific Service
To check if a particular service is running, use ps aux | grep <service-name>
:
ps aux | grep nginx
This will output lines that include "nginx," showing if it's running. The output may look like this:
root 1034 0.0 0.3 49536 3412 ? Ss 12:34 0:00 nginx: master process /usr/sbin/nginx
www-data 1035 0.0 0.2 49536 2824 ? S 12:34 0:00 nginx: worker process
user 2045 0.0 0.0 14856 900 pts/0 S+ 12:35 0:00 grep --color=auto nginx
Here:
- The first two lines indicate that the nginx service is running.
- The last line (
grep --color=auto nginx
) is thegrep
command itself. You can exclude it using:
ps aux | grep nginx | grep -v grep
Displaying Processes in a Hierarchical Format
For a more structured view, use:
ps fax
This shows a tree structure of running processes, making it easier to identify which services are running and their child processes.
Finding Services by Port
If you suspect a service is running on a specific port but are unsure of the service name, use:
netstat -tulnp | grep :80
or, if netstat
is not available:
ss -tulnp | grep :80
This will list the process using port 80 (commonly used by web servers like Nginx or Apache).
Summary
- Use
ps aux
to list all running processes. - Use
ps aux | grep <service-name>
to check for a specific service. - Use
ps fax
for a tree view of processes. - Use
netstat -tulnp
orss -tulnp
to find services running on specific ports.

FAQ (Frequently Asked Questions)
1. How do I check if a service is running on Linux?
You can use different methods depending on your Linux distribution:
- For systemd-based systems:
systemctl status <service-name>
- For SysVinit-based systems:
service <service-name> status
- Using ps and grep:
ps aux | grep <service-name>
2. How do I list all running services?
- For systemd-based systems:
systemctl list-units --type=service --state=running
- For SysVinit-based systems:
service --status-all
- Using
ps
command:ps aux
3. How can I check if a service starts at boot?
- For systemd:
systemctl is-enabled <service-name>
- For SysVinit (RHEL-based systems):
chkconfig --list <service-name>
4. How do I restart a service?
- For systemd-based systems:
sudo systemctl restart <service-name>
- For SysVinit-based systems:
sudo service <service-name> restart
5. How do I stop or disable a service?
- To stop a service temporarily:
sudo systemctl stop <service-name>
- To prevent a service from starting at boot:
sudo systemctl disable <service-name>
6. How can I find which service is using a specific port?
You can use netstat
or ss
to find services running on a specific port:
netstat -tulnp | grep :80
or
ss -tulnp | grep :80
7. What if systemctl
is not found?
If you get an error like command not found: systemctl
, it means your system might not be using systemd. Try using:
service --status-all
or
ps aux | grep <service-name>
8. How do I list failed services?
For systemd-based systems, run:
systemctl list-units --type=service --state=failed
9. How do I enable logging for a specific service?
To check logs for a service managed by systemd, use:
journalctl -u <service-name>
To view logs in real-time:
journalctl -u <service-name> -f
10. Can I use top
or htop
to see running services?
Yes! top
and htop
provide a live view of running processes:
- Use
top
:top
- Use
htop
(interactive and user-friendly):
(Install withhtop
sudo apt install htop
orsudo yum install htop
if not available.)