Using systemctl list services to View Running Services in Linux

Photo of author
By Jay
— 4 min read
Photo of author
Written by
Photo of author
Verified by
Published On
— 4 min read

systemctl list services

What is Systemd?

Systemd is an init system and system manager that has become the standard for most Linux distributions. It is responsible for initializing the system during the boot process and managing system services and daemons once the system is running. One of the essential commands for interacting with systemd is systemctl list services, which allows users to view all running services.

Here are some of the key features of systemd:

Service Management: With commands like systemctl list services, users can easily monitor and control the status of services, ensuring that everything is running smoothly.

Parallel Startup: Systemd speeds up the boot process by starting system services in parallel, rather than sequentially.

On-Demand Activation: Services can be started as they are needed, rather than all at once at boot time.

Socket-Based Activation: Services can be activated by incoming socket messages.

Device-Based Activation: Services can be started when certain hardware is plugged in.

Service Monitoring: Systemd can automatically restart crashed services.

Unified Configuration: Uses unit files to manage service configuration, providing a standardized way to handle service dependencies, startup order, and more.


How to List All Running Services Under Systemd

To interact with systemd and manage services, the primary command-line utility is systemctl. Below are detailed instructions on how to list all running services using systemctl.

How to List Currently Active Services with systemctl (List Running services)

To list all services that are currently active (running), use the following command:

systemctl list-units --type=service --state=running

This command will display a list of services that are currently running. Each entry will typically include the following information:

  • UNIT: The name of the service unit.
  • LOAD: Whether the unit’s configuration has been properly loaded.
  • ACTIVE: The high-level unit activation state (usually “active”).
  • SUB: The low-level unit activation state, specific to the unit type.
  • DESCRIPTION: A short description of the service.

Example output:

UNIT                         LOAD   ACTIVE SUB     DESCRIPTION
accounts-daemon.service      loaded active running Accounts Service
apache2.service              loaded active running The Apache HTTP Server
cron.service                 loaded active running Regular background program processing daemon

How to List All Services in Systemd

To see a list of all services, regardless of whether they are running, use the following command:

systemctl list-units --type=service

This command will show all service units, including those that are inactive, failed, or in any other state.

How to Check the Status of a Service in Systemd

To get detailed information about a specific service, use the status subcommand followed by the name of the service unit:

systemctl status <service-name>

Replace <service-name> with the name of the service you want to check. For example, to check the status of the Apache HTTP server, you would use:

systemctl status httpd

Example output:

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2024-07-04 12:34:56 UTC; 1h 23min ago
 Main PID: 1234 (httpd)
    Tasks: 6 (limit: 2345)
   Memory: 50.0M
   CGroup: /system.slice/httpd.service
           ├─1234 /usr/sbin/httpd -DFOREGROUND
           ├─1235 /usr/sbin/httpd -DFOREGROUND
           ├─1236 /usr/sbin/httpd -DFOREGROUND
           ├─1237 /usr/sbin/httpd -DFOREGROUND
           ├─1238 /usr/sbin/httpd -DFOREGROUND
           └─1239 /usr/sbin/httpd -DFOREGROUND

How to List of all systemd units

To see a list of all units (not just services), use the following command:

systemctl list-units

This command will display all units managed by systemd, including services, mounts, devices, sockets, and more.

How to List all systemd Units including Inactive

To list all units, including those that are inactive, use the --all flag:

systemctl list-units --all

This command will show units that are currently inactive as well as active units.

You can filter the output of systemctl commands using various options. For example, to list only failed services, you can use:

systemctl --failed

This will show services that have failed.

How to List all unit files installed on the system active and inactive both

To list all unit files installed on the system, whether or not they are currently active, use:

systemctl list-unit-files --type=service

This command will show the state of all service unit files, indicating whether they are enabled, disabled, static, or masked.

Wrapping Up

Systemd provides powerful tools for managing and monitoring services on a Linux system. By using the systemctl command, you can easily list running services, check their status, and manage their configurations. This detailed guide should help you understand how to interact with systemd and efficiently manage services on your Linux server.

Related Posts


About Author

Photo of author

Jay

I specialize in web development, hosting solutions, and technical support, offering a unique blend of expertise in crafting websites, troubleshooting complex server issues, and optimizing web performance. With a passion for empowering businesses and individuals online, I provide in-depth reviews, tech tutorials, and practical guides to simplify the digital landscape. My goal is to deliver clear, reliable, and insightful content that helps readers make informed decisions and enhance their online presence.

Leave a Comment