> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to List Services in Linux
- URL: https://itsfoss.com/linux-list-services/
- Published: 2023-09-29T08:06:50.000Z
- Updated: 2023-09-29T08:06:50.000Z
- Description: 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.
- Author: Sreenath
- Tags: Terminal, #hide

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](https://itsfoss.com/content/images/2023/06/use-systemctl-command-to-list-active-and-exited-services-in-Linux.png)

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](https://itsfoss.com/content/images/2023/09/system-ctl-list.png)

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](https://itsfoss.com/content/images/2023/09/systemctl-running-services.png)

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](https://itsfoss.com/content/images/2023/09/List-services-in-sysvinit.png)

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](https://itsfoss.com/content/images/2023/09/init.d-directory.png)

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](https://itsfoss.com/content/images/2023/09/listing-etc-sv.png)

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.](https://itsfoss.com/content/images/2023/09/list-etc-service.png)

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](https://itsfoss.com/content/images/2023/09/service-status-runit.png)

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](https://itsfoss.com/content/images/2023/09/rc-status-command.png)

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](https://itsfoss.com/content/images/2023/09/rc-status-a.png)

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](https://itsfoss.com/content/images/2023/09/rc-service-list.png)

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.](https://itsfoss.com/content/images/2023/09/rc-status-help.png)

`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.