Skip to Content

Best way to List all the services in Linux

The systemctl command is a powerful tool in Linux systems that serves as the interface to control and manage the systemd init system.

It is a central component responsible for initializing, managing, and maintaining various system processes and services during the boot process and while the system is running. 

With systemctl, users can start, stop, restart, enable, disable, and monitor various system services, making it an essential utility for managing the system’s behavior and services.

List all the services with systemctl command in Linux

You can use the following steps to list all the services using the systemctl command regardless of their current status.

  • Open a terminal
  • Switch to root user
  • Type the following command and press enter
    $ systemctl list-units --type service --all

 

Here’s a simplified example of what the output looks like:

UNIT LOAD ACTIVE SUB DESCRIPTION
acpid.service loaded active running ACPI event daemon
apparmor.service loaded active exited Load AppArmor profiles
auditd.service loaded active running Security Auditing Service
autofs.service loaded active running Automounts filesystems on demand
avahi-daemon.service loaded inactive dead Avahi mDNS/DNS-SD Stack

 

In this example, you can notice that services are listed regardless of whether they are active or not. This allows you to see a full inventory of services available on your Linux system, along with their descriptions and statuses.

Here’s a breakdown of what each column represents:

  • UNIT: The name of the service unit.
  • LOAD: Indicates whether the unit’s configuration is loaded.
  • ACTIVE: Shows the current activation state of the unit (active, inactive, etc.).
  • SUB: Provides the substate of the unit (running, exited, dead, etc.).
  • DESCRIPTION: A brief description of the service unit.

 

The “ACTIVE” column represents the overall state of the service, while the “SUB” column provides more specific information about the substate of the service.

You can also get more detailed info about systemd from the following video.

list all the active services with systemctl command

To list all the active services using the systemctl command, you can use the following command

systemctl list-units --type=service

By default, the systemctl list-units command displays only active service along with their current statuses and other relevant information.

UNIT LOAD ACTIVE SUB DESCRIPTION
acpid.service loaded active running ACPI event daemon
apparmor.service loaded active exited Load AppArmor profiles
atd.service loaded active running Deferred execution scheduler
auditd.service loaded active running Security Auditing Service

List all the enabled services with systemctl command in Linux

Let’s see one example.

systemctl list-unit-files --type service

Here is one example:

# systemctl list-unit-files --type service
UNIT FILE STATE
arp-ethers.service disabled
auditd.service enabled
auth-rpcgss-module.service static
[email protected] enabled
blk-availability.service disabled
[email protected] static

UNIT FILE: This column lists the names of different service unit files on your system. Each unit file defines the configuration and behavior of a specific service managed by systemd.

STATE: This column indicates the current state of each unit file. The possible states are “enabled,” “disabled,” or “static.”

Now, let’s explore more from the output:

  • arp-ethers.service: This service unit file is in the “disabled” state. This means that the service is configured to not start automatically at system boot.
  • auditd.service: This service unit file is in the “enabled” state. The service is set to start automatically at system boot.
  • auth-rpcgss-module.service: This service unit file is in the “static” state. A “static” state indicates that the unit file is not designed to be started as a standalone service. Instead, it is used to fulfill dependencies for other units.
  • [email protected]: This is a template unit file that represents virtual terminals (TTYs). The @ symbol indicates that it’s a template. The “enabled” state indicates that virtual terminals are available and can be activated.
  • blk-availability.service: This service unit file is in the “disabled” state, indicating that it’s not set to start automatically.
  • [email protected]: Another template unit file that represents a chronyd service using DNS-based synchronization. The “static” state indicates that it’s used for dependencies and not directly activated.

 

To list all enabled services in Linux, you can use the systemctl command with the list-unit-files option and filter for enabled services. Here’s the command:

systemctl list-unit-files --type=service --state=enabled

You can also use

systemctl list-unit-files --type=service| grep enabled

FAQ about systemctl command in Linux

What is the difference between start and enable in systemctl?

The start command starts a service immediately, while the enable command configures a service to start at boot time. So, using enable ensures that the service starts automatically when the system boots up.

How to view the logs for a service using systemctl?

You can view the logs for a service using the journalctl command with the -u option followed by the service name. For example:

journalctl -u apache2

Can I use systemctl without root privileges?

Most systemctl commands require root (sudo) privileges because they involve system-level operations. However, some distributions allow certain systemctl commands to be run by non-root users using sudo.

What is the systemctl list-units command used for?

The systemctl list-units command lists all active units (services, sockets, devices, etc.) in the current systemd session, providing information about their status and health.

wlkd

Sunday 10th of September 2023

Cool. Is there any way to list all enabled services?

David Cao

Sunday 10th of September 2023

You can use systemctl list-unit-files --state=enabled --type=service

Refer to this article for more

Top 3 ways to check if a service is enabled in Linux

Henai

Wednesday 6th of September 2023

It is very helpful. Thanks a lot.