how we can see all running services Linux machine?
Categories:
How to List All Running Services on a Linux Machine

Discover various commands and techniques to identify and manage active services on your Linux system, essential for system administration and troubleshooting.
Understanding which services are running on a Linux machine is a fundamental skill for system administrators, developers, and DevOps engineers. Active services consume system resources and can impact performance, security, and overall system behavior. This article will guide you through the most common and effective methods to list all running services, providing practical examples and explanations for each approach.
Understanding Linux Service Management
Linux distributions primarily use two main init systems for managing services: systemd
and SysVinit
(or Upstart
in some older distributions). Modern distributions like Ubuntu (since 15.04), CentOS/RHEL (since 7), and Debian (since 8) have largely adopted systemd
. Knowing which init system your machine uses is crucial for selecting the correct commands.
flowchart TD A[Start] A --> B{Which Init System?} B -->|systemd| C[Use systemctl] B -->|SysVinit/Upstart| D[Use service/init.d] C --> E[List all units: systemctl list-units --type=service --state=running] D --> F[List all services: service --status-all] E --> G[Analyze Output] F --> G[Analyze Output] G --> H[End]
Decision flow for identifying running services based on init system.
Using systemctl
for systemd
Managed Services
systemctl
is the primary command-line utility for controlling the systemd
system and service manager. It allows you to inspect and control the state of the systemd
system. To list all currently running services, you can use specific systemctl
commands.
systemctl list-units --type=service --state=running
List all active and running services managed by systemd.
This command provides a detailed list, including the unit name, load state, active state, and a description. If you want to see all services, regardless of their state (running, stopped, failed, etc.), you can omit the --state=running
flag:
systemctl list-units --type=service --all
List all services, including inactive ones, managed by systemd.
systemctl
to grep
to search for a specific service. For example, systemctl list-units --type=service --state=running | grep ssh
will show if the SSH service is running.Using service
and init.d
for SysVinit
Managed Services
For older Linux distributions or systems still using SysVinit
(or Upstart
), the service
command is typically used to manage services. While systemd
is dominant, understanding these commands is still valuable for legacy systems.
service --status-all
List the status of all services managed by SysVinit/Upstart.
This command iterates through all known services and displays their status. A [ + ]
usually indicates a running service, [ - ]
indicates a stopped service, and [ ? ]
means the status is unknown or not applicable. Alternatively, you can directly inspect the /etc/init.d/
directory, which contains the scripts for SysVinit services.
ls /etc/init.d/
# To check a specific service:
/etc/init.d/apache2 status
Listing init.d scripts and checking a specific service status.
Other Useful Commands for Identifying Running Processes
Beyond dedicated service management commands, several other Linux utilities can help identify running processes that might correspond to services, even if not formally registered with an init system.
ps
and top
show running processes, they don't always directly map to 'services' in the systemd/SysVinit sense. A service might run multiple processes, or a process might not be part of a formal service.Using ps
ps aux | grep -i 'service_name'
To see all processes with their command line arguments
ps -ef
Using top
or htop
top
For a more user-friendly interactive process viewer
htop
Using netstat
or ss
(for network services)
netstat -tulnp
Modern alternative to netstat
ss -tulnp
These commands are invaluable for a more granular view of what's happening on your system, especially when debugging or looking for processes that might not be managed by the standard service managers.