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 ?
$ 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:
6. How to List the groups that use the most resources ?
Run the following command to do so:
[Need to fix any Technical issue ? We can help you. ]