Debian

How to List Services in Debian 12

How to List Services in Debian 12

Services are background programs that keep waiting and are ready to use when needed. Some of these services that usually run on your system are DHCP Client, DNS, Power, and System Management services. At some point, you might need to list all services on your system because they are the key part of server management that helps you during the troubleshooting. While listing the services, you can stop those services that consume your system resources, thus improving your system performance.

This guide aims to provide you with the various methods to list services in Debian 12.

Quick Outline

How to List Services in Debian 12

Conclusion

 

How to List Services in Debian 12

The following are the commands used to list services in Debian 12:

 

1: Use the systemctl Command to List Services in Debian 12

systemctl command is a widely used command in Linux systems that are managed by the systemd, a default service manager. With systemctl command, you can view whether a specific service is enabled on your system. Further, it also helps you disable, restart, stop, or mask the services on your system. In case of any issue, check the current status of your services through the systemctl command. The basic syntax of using the systemctl command is written below:

systemctl [Options...] [Command NAME...]

Here, Options specify the output, and the Command NAME defines the service command. The details of each service is located in the /usr/lib/systemd directory on Debian. Using the systemctl command on your system, you can display:

 

1: List All Services on Debian 12

The following command will list all the running services including enabled, running, stopped, and disabled services on your Debian system:

systemctl list-units --type=service --all

Press Q to exit the services list and return to the terminal. You can also use the systemctl command without the list-units parameter:

systemctl --type=service --all

You can also use a simple systemctl command without passing any arguments to list down all the loaded system units on Debian:

systemctl

 

2: List All Enabled Services on Debian 12

The enabled services automatically start when you turn on your system. To display all the enabled services under systemd on Debian, execute the following systemctl command;

systemctl list-unit-files --state=enabled

 

3: List Running Services on Debian 12

To quickly view the list of all running services on Debian, run the following command in the terminal:

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

In the above output:

UNIT: Name of the service.

LOAD: Verify whether the files are parsed by systemd or not.

ACTIVE: High-level state of the service.

SUB: Low-level state of the service.

DESCRIPTION: Detailed information about the service.

 

4: List Active Services on Debian 12

The following command will display the active services on your Debian:

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

 

5: List Disabled Services on Debian 12

Disabled services will not start automatically when you start a system. To view the disabled services on Debian, execute the following command:

systemctl list-unit-files --state=disabled

 

6: View Detail Information of Running Services on Debian 12

You can also view the detailed information of any running service on your Debian system using the following systemctl command:

systemctl status [service_name]

Here, we want to get information related to snapd on Debian 12:

systemctl status snapd

 

7: Check Time Required by a Service to boot on Debian

Each service requires a specific time to start on your system and to check the time, you can execute the below-given command that will display the time of all the services:

systemd-analyze blame

 

2: Use service Command to List Services in Debian 12

Besides using the systemctl command, you can also use the service command to display all the services on your Debian system. By default, the service command-line utility is installed on Debian, however, if it is not, run the following apt command to install it:

sudo apt install sysvinit-utils

You can then use the service command on Debian to list:

 

1: List All Services on Debian 12

Run the following command in the terminal to list all the services on Debian using the service command:

sudo service --status-all

 

2: List Running Services on Debian 12

To list only running services on Debian, execute the grep command along with the service utility:

sudo service --status-all | grep '\[ + \]'

 

3: List Stopped Services on Debian 12

You can also list services that are stopped on your Debian system by using the following command:

sudo service --status-all | grep '\[ - \]'

 

3: Use pstree Command to List Services in Debian 12

The pstree command can also be used in Debian to display all the running services in a concise tree-like structure. It is a more convenient method compared to the above-given methods for displaying the list of services on your system.

pstree

 

To sort the services, execute the following command:

pstree -n

To highlight the current processes, run the below command

pstree -h

 

Conclusion

Services are programs that start automatically in the background when you turn on your system. You can list down the services in Debian 12 to manage them efficiently. The systemctl is a powerful command used to list all of your system services. Other commands include service and pstree that help you list down the services on the terminal. We have discussed the detailed usage of these commands in the above section of this post. Follow these methods to list the services and stop them in case you don’t need them on your Debian system.

Similar Posts