+3 votes
59 views
List Linux Services

in Linux/Unix by (552k points)
reopened | 59 views

1 Answer

+4 votes
Best answer

How to list Linux services with Systemctl

When we administer Linux Operating Systems we must take into account that there are a series of parameters that are essential for the proper functioning of the system in general and one of these are the Linux services..

 

Basically a service in Linux runs in the background and its task is to give a specific function in the system. The default services (mostly) start automatically during system boot and will be active and running in the background in order to respond to requests generated by applications or the user.

 

In Linux Operating Systems, services are managed through the startup system, which is in charge of starting, stopping, and managing these services in the background, normally the startup system is SysVinit, systemd, Upstart, or some others, taking into account account the distribution used..

 

 

Systemctl is a command in Linux with which it is possible to control the systemd startup system, thanks to this command as users we will be able to manage background services, system units and system sockets creating an availability environment much more complete. Systemctl gives us the opportunity to start, stop, restart and verify the status of background services as well as disable that service from starting automatically or perform extra tasks such as:

 

Systemctl Tasks

 

  • Check the status of system drives.
  • Validate file system mounts.
  • Manage network devices, storage devices and more.

 

 

TechnoWikis will explain how to use systemctl to list the services in Linux and thus manage them in a much more complete way.

 

 

To stay up to date, remember to subscribe to our YouTube channel!
SUBSCRIBE ON YOUTUBE

 

How to list Linux services with Systemctl

 

Step 1

We open the terminal and list the desired entries to check Systemd:
 pstree | head -# 
Step 2

There we have validated the process tree with the pstree command and we noticed that Systemd is used.

 

 

image

 

Step 3

We validate the running services:
 systemctl --type=service --state=running 
image

 

Step 4

You can use the directional arrows to see more content:

 

image

 

step 5

We found details like:

 

  • Unit: is the name of the service or daemon.
  • Load: indicates the load status of the service or daemon, its options are loaded, not-found, bad-setting, error, or masked.
  • Active: indicates the current general status of the service or daemon, the options are active, reloading, inactive, failed, activating, or deactivating.
  • SUB: is the substatus of the service or daemon, there we can see results such as dead, exited, failed, inactive, or running.
  • Description: It is a brief description of the service.

 

step 6

You can see the status of a specific process:
 systemctl --type=service --state=running | grep(name) 
image

 

step 7

We validate failed services:
 systemctl --type=service --state=failed 
image

 

step 8

It is possible to enter two states simultaneously:
 systemctl --type=service --state=failed,exited 
image

 

step 9

We use the directional arrows to see the other results:

 

image

 

step 10

To list active file units we execute the command. Allie we found details such as the name of the unit, its current state and other values.
 systemctl list-unit-files --state=enabled 
image

 

step 11

We remove the “—state” parameter for general results:
 systemctl list-unit-files 
image

 

step 12

You can use various parameter options if necessary:
 systemctl list-unit-files --state=enabled,failed 
image

 

step 13

To validate the disabled file units we execute:
 systemctl list-unit-files --state=disabled,failed 
image

 

step 14

To see a service in detail we execute:
 systemctl status (service) 
image

 

step 15

There we see values ​​like:

 

  • The name of the service
  • The process ID of the instance
  • Path to unit file
  • How much CPU time has been used
  • Concurrent instances of this service and more

 

Thanks to Systemctl we will be able to take complete control over the services in Linux and thus manage them efficiently..

 


by (3.5m points)
edited

Related questions

+5 votes
1 answer
+4 votes
1 answer
asked Jul 3, 2023 in Linux/Unix by backtothefuture (552k points) | 64 views
+4 votes
1 answer
asked Jun 2, 2020 in Linux / Unix by backtothefuture (552k points) | 308 views
+3 votes
1 answer
asked Feb 17, 2020 in Linux / Unix by backtothefuture (552k points) | 309 views
+3 votes
1 answer
asked Nov 2, 2019 in Linux / Unix by backtothefuture (552k points) | 269 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users