How Can I Check Which Services Are Running in Linux?

In the world of Linux, understanding which services are running on your system is crucial for maintaining performance, security, and stability. Whether you’re a system administrator, developer, or an enthusiastic user, having a clear picture of active services can help you troubleshoot issues, optimize resource usage, and ensure that essential processes are functioning correctly. But with the vast array of tools and commands available, knowing where to start can sometimes feel overwhelming.

Checking running services in Linux isn’t just about curiosity—it’s a foundational skill that empowers you to take control of your system’s behavior. From background daemons to critical network services, each plays a role in the overall operation of your machine. Gaining insight into these processes allows you to make informed decisions about which services to enable, disable, or monitor more closely.

This article will guide you through the essentials of identifying active services on your Linux system. By exploring the common methods and commands used to list and manage these services, you’ll build a solid understanding that prepares you for more advanced system management tasks ahead. Whether you’re managing a personal computer or a production server, mastering this knowledge is a step toward greater confidence and control in the Linux environment.

Using systemctl to Check Running Services

The `systemctl` command is the primary tool for managing services on modern Linux distributions that use the systemd init system. To view which services are currently running, you can use `systemctl` with specific flags.

To list all active (running) services, the command is:

“`bash
systemctl list-units –type=service –state=running
“`

This command outputs a list of service units that are currently in the running state. The output includes the service name, load state, active state, and a brief description.

Key points about this command:

  • `–type=service` filters the units to show only services.
  • `–state=running` limits output to services actively running.
  • It provides a real-time snapshot of the services systemd is currently managing.

You can also use `systemctl` to check the status of a specific service by running:

“`bash
systemctl status
“`

This provides detailed information including the service’s current state, recent logs, and whether it is enabled to start at boot.

Checking Services with service Command

On older Linux systems or those using SysV init scripts, the `service` command is commonly used to interact with system services. While not as feature-rich as `systemctl`, it remains useful for checking service status.

To see the status of a particular service, execute:

“`bash
service status
“`

This returns whether the service is running, stopped, or in another state. However, it does not provide a consolidated list of all running services.

To get a list of all services and their status on SysV systems, you can examine the contents of `/etc/init.d/` and manually check each service, or use:

“`bash
service –status-all
“`

This command lists all services with symbols indicating their status:

  • `[ + ]` means the service is running
  • `[ – ]` means it is stopped
  • `[ ? ]` means the status is unknown

Using ps and grep to Identify Running Service Processes

Another method to check running services is by inspecting processes directly. Since services run as processes, you can use `ps` combined with `grep` to find them.

For example:

“`bash
ps aux | grep
“`

This command searches the process list for any entries related to the specified service. It is helpful for verifying if a service’s daemon or process is active.

To list all system services by process name, common service names include:

  • `sshd` for SSH daemon
  • `httpd` or `apache2` for Apache web server
  • `mysqld` for MySQL server

Using `ps` can be combined with `grep` and `awk` to script detailed checks.

Viewing Services with chkconfig and rc-status

On certain Linux distributions, especially older Red Hat-based or Gentoo systems, `chkconfig` and `rc-status` are used to manage and check services.

  • `chkconfig –list` shows the runlevel settings and whether services are set to start at boot.
  • `rc-status` provides a list of services and their current status in Gentoo systems.

These commands are useful in environments where systemd is not available.

Summary of Common Commands to Check Running Services

Command Purpose Applicable Systems Output Example
systemctl list-units --type=service --state=running Lists all running systemd services Modern Linux (systemd) ssh.service loaded active running OpenSSH server daemon
service --status-all Lists status of all SysV services Older Linux distributions [ + ] sshd [ – ] apache2
ps aux | grep <service-name> Checks running processes related to a service All Linux systems root 1234 0.0 0.1 123456 7890 ? Ss 10:00 0:00 sshd: user
chkconfig --list Shows services and runlevel status Older Red Hat-based systems sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
rc-status Lists service status on Gentoo Gentoo Linux sshd [started]

Methods to Identify Running Services in Linux

Determining which services are active on a Linux system is essential for system administration, troubleshooting, and security auditing. Linux distributions primarily utilize different init systems such as systemd, SysVinit, or Upstart, and the commands to check running services vary accordingly.

Using systemd-based Commands

Most modern Linux distributions including Ubuntu (from 15.04), CentOS 7+, Debian 8+, and Fedora use systemd as the init system. The systemctl utility provides a comprehensive interface to manage and query system services.

  • systemctl list-units --type=service --state=running: Lists all services currently active and running.
  • systemctl status <service_name>: Displays detailed information about a specific service, including its status, logs, and dependencies.
  • systemctl is-active <service_name>: Returns whether a service is active or not, useful for scripting.
Command Description Example Output
systemctl list-units --type=service --state=running Lists all running services
  ssh.service          loaded active running OpenSSH server daemon
  cron.service         loaded active running Regular background program processing daemon
        
systemctl status ssh.service Shows detailed status of SSH service
● ssh.service - OpenSSH server daemon
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2024-06-14 09:22:10 UTC; 3h ago
        

Using SysVinit Commands

Some older or specialized Linux distributions still use the traditional SysVinit system. In these cases, service management is done via scripts located in /etc/init.d/ or managed by the service command.

  • service --status-all: Lists all available services with their status indicated by symbols.
  • service <service_name> status: Checks the status of a particular service.

The status symbols in service --status-all output are:

  • [ + ]: Service is running
  • [ - ]: Service is stopped
  • [ ? ]: Status unknown or unsupported

Using Upstart Commands

Some Ubuntu versions and other distributions use Upstart as their init system. Services can be checked using the initctl command.

  • initctl list: Lists all services and their statuses.
  • initctl status <service_name>: Shows the status of a specific service.

Alternative Commands to Investigate Running Services and Processes

In addition to init system-specific tools, Linux offers several general-purpose commands that can help identify active services by inspecting processes and network ports.

  • ps aux | grep <service_name>: Searches for the service process in the running processes list.
  • netstat -tulnp or ss -tulnp: Displays network sockets listening on TCP and UDP ports, often associated with running services.
  • top or htop: Interactive tools to monitor active processes in real-time.

Summary Table of Commands to Check Running Services

Expert Perspectives on Checking Running Services in Linux

Dr. Elena Martinez (Senior Linux Systems Architect, OpenSource Solutions Inc.) emphasizes, “To effectively check which services are running in Linux, leveraging the ‘systemctl list-units –type=service’ command is essential. It provides a comprehensive overview of active, inactive, and failed services, enabling administrators to maintain system health and troubleshoot efficiently.”

Rajiv Patel (DevOps Engineer, CloudTech Innovations) advises, “Using the ‘service –status-all’ command remains a reliable method for quickly viewing the status of all services on traditional SysVinit systems. However, modern Linux distributions increasingly rely on systemd, so understanding both approaches ensures compatibility across environments.”

Lisa Chen (Linux Security Analyst, CyberGuard Labs) notes, “Regularly auditing running services with tools like ‘ps aux’ combined with ‘grep’ can help identify unauthorized or unexpected processes. This practice is critical for maintaining system security and detecting potential vulnerabilities early.”

Frequently Asked Questions (FAQs)

What command lists all active services on a Linux system?
The command `systemctl list-units –type=service –state=running` displays all currently running services managed by systemd.

How can I check the status of a specific service in Linux?
Use `systemctl status ` to view detailed information about the service’s current status, including whether it is active or inactive.

Which command shows all services, including inactive ones?
Executing `systemctl list-units –type=service` lists all loaded services regardless of their running state.

How do I find running services on systems without systemd?
On SysVinit systems, `service –status-all` or checking `/etc/init.d/` scripts can help identify running services.

Can I use `ps` to find running services?
Yes, `ps aux` lists all running processes, and filtering with `grep` can help identify specific service processes.

How do I check if a service is enabled to start at boot?
Run `systemctl is-enabled ` to determine if the service is configured to start automatically during system boot.
In summary, checking which services are running in Linux is a fundamental task for system administration and troubleshooting. Various commands and tools, such as `systemctl`, `service`, `ps`, and `top`, provide detailed insights into active services and processes. Understanding the differences between SysVinit and systemd-based systems is crucial, as it determines the appropriate commands to use for managing and inspecting services.

Leveraging commands like `systemctl list-units –type=service` on systemd systems or `service –status-all` on older distributions allows administrators to efficiently monitor service status. Additionally, tools like `ps aux` and `top` offer a process-level view, which complements service-level information. Properly checking running services ensures system stability, security, and optimized resource utilization.

Ultimately, mastering these commands and concepts empowers Linux users and administrators to maintain control over their environments, quickly identify issues, and make informed decisions regarding service management. Regular monitoring and understanding of running services are essential practices for maintaining robust and secure Linux systems.

Author Profile

Avatar
Harold Trujillo
Harold Trujillo is the founder of Computing Architectures, a blog created to make technology clear and approachable for everyone. Raised in Albuquerque, New Mexico, Harold developed an early fascination with computers that grew into a degree in Computer Engineering from Arizona State University. He later worked as a systems architect, designing distributed platforms and optimizing enterprise performance. Along the way, he discovered a passion for teaching and simplifying complex ideas.

Through his writing, Harold shares practical knowledge on operating systems, PC builds, performance tuning, and IT management, helping readers gain confidence in understanding and working with technology.
Init System Primary Command Purpose
systemd systemctl list-units --type=service --state=running List all running services
SysVinit service --status-all List all services with status symbols
Upstart initctl list List all services and statuses
General Process Check ps aux | grep <service_name> Check if a specific service process is running
Network Socket Check ss -tulnp List all listening ports and associated services