Phone :  +370 (5) 204-1903
Email :  sales@1gbits.com
  1. Dedicated server
  2. Blog
  3. How to list running services in Linux?

How to list running services in Linux?

 

Linux Tutorial Jul 25, 23 by Nisal N 6 min Read
How to list running services in Linux?

List of content you will read in this article:

Powerful open-source software called Linux was initially introduced in 1991. It is based on the Unix operating system and has been deployed on various gadgets, including supercomputers and cellphones.

The dependability, adaptability, and security aspects of Linux are well known. It can be utilized alone or as a component of a bigger networked system.

A Linux service is a server's response to a request that carries out a certain operation. It is a program or application that typically runs in the background.

Technically speaking, a service is a process or collection of processes (often referred to as daemons) that are continuously operating in the background and waiting for requests to arrive (especially from clients).

Linux provides a variety of management options for services, often via a process or service manager.

The first step in listing the active services on a Linux system is to identify the system manager. Since the commands used to list running services in Linux are based on the system manager, this step is very crucial.

Listing services in the systemd Service Manager

Let's look at each method available to list services when systemd is the system manager.

Using Systemctl command to list all the services

You may list the services in your Linux system with the systemctl command.

All services are listed when the —type=service option is used with the list-units subcommand. It comprises active, unsuccessful, active (exited), and active (running) services.

systemctl list-units --type=service

There are multiple columns in the output. Let's learn what they stand for.

  • UNIT: This object manages the services, which also initiates and stops them.
  • LOAD: Indicates whether or not the specific unit is properly loaded.
  • ACTIVE: A high-level state that decides whether a unit is active or not.
  • SUB: It symbolizes the unit's low-level activation state.
  • DESCRIPTION: It describes the work that the unit does.

Using the systemctl Command to list active services in Linux

To filter the services, you must use particular options with the systemctl command. You can modify the state of the services using the —state option.

For instance, you may display only the active services in the following command.

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

To identify only the active services, we have used the —state option with the value active. The active state of each unit is displayed in the output.

list running services in Linux using the systemctl Command

Use the following command only to list services that are currently running.

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

An active value for the ACTIVE state and a running value for the SUB state are both present in a running service.

Using the systemctl command to list the terminated services

Exited services are one-shot services that complete their task and are shut off. The exited services can be listed using the command below:

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

Using the systemctl command to list the failed services

Similarly, the following command will list the failed services:

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

Listing services in the SysV service manager

In this part, you will discover a couple of techniques for listing the system services that use the SysV service manager.

Using the SysV service management, you can use the service command to list every service on a system.

service --status-all

In the output, the state of the services is indicated by the symbols in brackets.

+: represents the running services

-: represents the stopped services

?: represents the services that don’t have a status command

You can use the following command only to list running services in Linux:

service --status-all | grep running

🔒 Level up your online security and reliability with our top-notch VPS! 🛡️💪 Harness the strength of dedicated resources while keeping your data safe and your website running smoothly. 💻🔒

Best practices to list running services in Linux

On Linux, managing services can be difficult. In addition to your chosen distribution, there are other tips you should be aware of if you wish to list operating services on Linux.

Here are some starting point suggestions:

  • Make a list of the services you require and their dependencies

Choose what needs to be executed. Take stock of the system's requirements before starting the list and select which services should be started automatically. By doing this, confusion and time wasted running pointless services will be reduced.

  • Set up your system to run as efficiently as possible
  • Implement a service manager. Systemd and upstart are just two of the available service managers. Both have benefits and drawbacks, so selecting the option that best meets your needs is critical.

Use systemd or UPnPd, for instance, to manage service setup and termination. To manage service restarts and status updates, use systemctl.

  • Keep in mind that some services are necessary for your Linux system to run and cannot be deactivated.
  • It's preferable to err on the side of caution and keep a service running if you're unsure whether or not it can be stopped securely.

Conclusion

Linux is a flexible and powerful operating system that can be employed for a variety of tasks, including running a server, as it was described in our guide. For those who wish to cut costs and have greater control over their computing environment, running a server on Linux can be a terrific alternative.

Services and daemons are essential because they offer many of the operating system's automatic functions. Because of this, their health is also crucial.

It's simple and useful to get a view of your services, daemons, and unit files. If a service or daemon won't start, it's also a useful step in debugging.

On Linux, running services can be a challenging and intimidating task. You can use a few methods to display all Linux services currently active or get a general notion of what's happening. This article would help you list running services in Linux without any trouble.

People also read:

author img

Nisal N

Computers has always fascinated me since I was a kid and here we are. I love travelling for 2 reasons: the first one to see a new part of the world and second (the most important one) to experience the rich culture hidden among the country and people. I'm pretty good at cooking but very poor when it comes to baking.

Leave A Comment