List Services on Ubuntu 20.04 - All about it ?


If you are the system administrator, you can see all the services like process manager, login, syslog, and so on running in the background on your device.

These services help with how the system works and connects to other programs. And you can also list all these services on Ubuntu.

Here at Ibmi Media, we shall look into how to list all services by using the systemctl command on Ubuntu 20.04.


What is the syntax of the systemctl command ?

It's syntax is given below:

$ systemctl [options] [command]

To list all the services, run:

$ systemctl --no-pager


1. How to list all unit files ?

To do this, Run the following command:

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


2. How to list systemd unit files ?

To do this, Run:

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


3. How to combine grep command to search for specific unit file ?

The syntax:

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

For example, We want to search for “session”:

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


4. How to list systemd service unit files by state ?

We will combine the grep command to do this. For example, We will list systemd service unit files are in the enabled state:

$ systemctl list-unit-files | grep enabled

Also, you may want to list systemd service unit files in the disabled state with the below command:

$ systemctl list-unit-files | grep disabled


5. How to list services using pstree command ?

The command to do so is given below:

$ pstree


6. How to List the groups that use the most resources ?

Run the following command to do so:

$ systemd-cgtop


[Need to fix any Technical issue ? We can help you. ]


Conclusion

This article covers how to list all services by using the systemctl command on Ubuntu 20.04. In fact, systemctl is a command-line utility that is used for controlling systemd and managing services, which is part of systemd.


The syntax is the rule and format of how the systemctl command can be used.

These syntax options can be reordered, but a straight format must be followed:

systemctl [OPTIONS.] {COMMAND} 
  • COMMAND: Replace COMMAND.. with the name of the command service names.
  • -t –type=TYPE, –state=STATE: Use the -t or –type or –state=STATE to list units of a particular type of service state: Active, Inactive.
  • -a –all: Use the -a or –all to show all properties/all units currently in memory, including dead/empty ones. To list all units installed on the system, use the 'list-unit-files' command instead.
  • -r –recursive: Use the -r or –recursive to show unit list of host and local containers.
  • –help: Display a help message and exit.

For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com