How to list services in Ubuntu

The various services in your Ubuntu Linux distribution run in the background, and as a system administrator, you will need to be able to view all services, including system services such as process management, login, cron jobs, and syslog. Ubuntu allows you to list all of these services using specific commands.

Background processes or system programs are also “daemons.” These services are responsible for the operation of the system and its communication with other programs. When working in a Linux environment like Ubuntu, you can use the Service Manager to conveniently manage all system services. The systemd process manager is now used in most recent Linux distributions, including Ubuntu. On Ubuntu, systemd is the default service manager, replacing the old init process.

This article will discuss the commands that can be used to list services in Ubuntu. So let’s get started:

List services using systemctl command in Ubuntu

Systemctl is a utility that is used to maintain system services, the general syntax is as follows:

$ systemctl [OPTIONS] <COMMAND>

When used with no parameters, the systemctl command lists all Ubuntu services. Run the command below to get a list of all services:

$ systemctl --no-pager

As a result, we will receive the following information:

  • UNIT: Displays the corresponding systemd unit name details.
  • LOAD: The device information is displayed regardless of whether it is currently loaded into memory or not.
  • ACTIVE: to check the active state of the system unit.
  • SUB: to check the working status of the system unit.
  • DESCRIPTION: Gives detailed information about the device.

List of all module files

Modular files are simple ini style text files that contain observable file system path, startup target, socket, device, mount point and system controlled timer, run the command below to list all module files using systemctl:

$ systemctl list-units --all --type=service --no-pager

List of systemd unit files

Instead of showing the type and running status of all available systemd unit files, it will be done as follows. Use the above command to list all system block files:

$ systemctl list-unit-files --no-pager

Finding a specific module file: Following is the syntax for searching for a specific module file using “grep”:

$ systemctl list-unit-files --no-pager | grep service_name

If you want to find “snapd” run the following command:

$ systemctl list-unit-files --no-pager | grep snapd

The above output shows all of the module files that are associated with the snapd service.

List of systemd service unit files by state (enabled / disabled)

On Ubuntu, the systemctl command will display information about all included systemd unit files using the command below:

$ systemctl list-unit-files | grep enabled

On Ubuntu, the systemctl command will display information about all disabled systemd unit files using the command below:

$ systemctl list-unit-files | grep disabled

List of all active and running services

To list all running services, run the following command:

$ systemctl list-units --all --type=services --no-pager | grep running

List of all demanded services

To list all excited services, run the command below, excited services are active services that don’t find any daemon to monitor:

$ systemctl list-units --all --type=services --no-pager | grep excited

The output shows that there is currently no invoked service on the system.

List of all dead services

To list all dead services, run the following command:

$ systemctl list-units –all –type = services –no-pager | grep dead

Listing services using pstree command in Ubuntu

To list all running Ubuntu services, run the command below:

$ pstree

How to List Top Control Groups Using Resources

Run the following command to list the main management groups using “systemd-cgtop”:

$ systemd-cgtop

Conclusion

Ubuntu has many services that run in the background. These services are also known as daemons and describe how the system works. We can list Ubuntu services using different commands on the terminal. In this article, we have discussed the list of module files running, excited, dead, enabled and disabled services using the “systemctl” command. Also mentioned is listing services using the “pstree” command. After reading this article, you should be able to successfully list the various Ubuntu services.

Related Posts