How to List Services in Linux

Checking the service status is one of the first few steps for troubleshooting a Linux system. Learn to list services on your system in this tutorial.
Warp Terminal

Listing the services gives you an idea of the activity status of multiple services.

But why would one be interested in checking the activity status of a service? Well, it is one of the first few steps system administrators take for troubleshooting purposes in Linux.

As most Linux systems come with systemd these days, you can use the command below to list the services:

systemctl list-units --type=service

But there are other init systems such as runit and SysVinit that are used to manage Linux services. The above command won't work for them.

Fret not! In this tutorial, I will show you how to check services in:

  • systemd
  • sysvinit
  • runit
  • OpenRC
πŸ’‘
Check witch init system you are using with the command ps -p 1 -o comm=

So let's start with the most popular systemd to list services on Linux.

Use the systemctl command to list services

If you are using Ubuntu, Debian, Arch, Fedora, or any other mainline distro, your system is powered by systemd, an init system responsible to start and manage services.

And to manage Linux services with systemd, you use the systemctl command.

The same goes for listing services:

systemctl list-units --type=service
Listing Linux services with systemctl command
List Services in Systemd

Here, I have used the list-units paired with the --type=service to list all the services.

Did you notice anything strange? It only showed active processes that are either running or exited. Basically, it shows only the active services. if that's what you want, you can relax at this point.

But what if you want to list all the system services, including inactive units? Simple. You use one more flag --all as shown here:

systemctl list-units --type=service --all
Use systemctl command to list all services, like active and inactive
List all service in Systemd

You can now see the inactive services too with inactive status under the ACTIVE column.

List running services only

If you want to list only the running services, use:

systemctl list-units --type=service --state=running
List all running services in Systemd using systemctl command
List Running Services in Systemd

Here's the brief of systemctl commands for listing unit files:

Command Description
systemctl list-units --type=service List active (running and exited) services
systemctl list-units --type=service --all List all services (active and inactive)
systemctl list-units --type=service --state=running List only running services

Use service command to get service list in Linux with sysvinit

In SysVinit systems, such as MX Linux default installation, you can list services using the service command.

First, open the terminal and run:

service --status-all

This will list sysvinit services, all of them, running, stopped etc.

List Services in SysVinit using service command
List All Services in SysVinit

The above command runs all init scripts in /etc/init.d/, in alphabetical order, with the status command.

Here, the services are listed with some preceding symbols. As you can see, I have highlighted three of those using yellow color in the above screenshot.

The meaning of those are:

  • [ + ] : It is a running Service
  • [ - ] : It is a stopped Service
  • [ ? ] : Services without a status command
🚧
This option only calls status for SysVinit jobs.

If you just want to list all the available services, use:

ls /etc/init.d
Contents of /etc/init.d directory, that contains all the available services
Content of /etc/init.d directory

Because, all the init scripts are stored in this directory. But the issue with this is, you cannot say that a script actually belongs to a running service or not.

Listing services in Runit

Here, I have used AntiX Linux Runit version as an example.

In Runit, there is a directory called /etc/sv where all the available services that can be enabled are listed.

List the /etc/sv directory in Runit systems to list all available services
Listing Services in Runit

Now, if you want to list the services running currently, you need to list another directory, called /etc/runit/runsvdir/current

ls /etc/runit/runsvdir/current/

On a running system, this currently running services are accessible via the /var/service symlink.

ls /etc/service

Or in some systems,

ls /var/service
Listing Contents of /etc/service directory to show that the currently running services are accessible via the /var/service symlink.
Contents of /etc/service directory
πŸ’‘
Each service managed or available in Runit has an associated service directory and, inside that directory, an executable run file. Optionally, they contain other files like check, finish, etc. Additionally, a supervise folder will be automatically created on the first run.

You can show the show status of enabled services by:

sv status /etc/service/*

Or in some systems,

sv status /var/service
Get service status in Runit system using the sv command
Getting Service Status in Runit

Listing services in OpenRC

In OpenRC, we use the command rc-status to list the services.

Open a terminal and run:

rc-status
List Services in Open RC using rc-status command
List Services in Open RC

This will show the scripts that exist in runlevels.

To show services from all runlevels, run:

rc-status -a
Show services from all runlevels using rc-statius with -a option
Show services from all runlevels

To show the service list, run:

rc-status --servicelist
Show Service list in Open RC using rc-status --servicelist option
Show Service list in Open RC

A similar function is performed, if you list the /etc/initrd, but this time, listing the services, without status.

ls /etc/init.d

You can use the below command to get various other options available:

rc-status --help
The help page of rc-status command, listing more available options.
rc-status Command Help

Conclusion

So, now you know how to list running services in a Linux machine. Since there are multiple init systems in the fragmented Linux ecosystem, I have covered the popular ones not just systemd service manager.

Hope it helps you.

About the author
Sreenath

Sreenath

Linux tinkerer by day, Lord of the Rings fanatic by night. When I'm not busy conquering the command line, you can find me kicking back and watching some football while quoting JRR Tolkien

It's FOSS

Making You a Better Linux User

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.