Different operations are running in the background of Ubuntu and are not visible to the users. These services run for specific purposes and can only be managed by some utilities. One of these utilities is “systemctl” to start/stop services. These services make the processing unit of the computer busy, which consumes the battery health as well as slows down other programs.
Considering the importance of services, this post will provide the methods to check services on Linux. The outcomes of this article are:
- How to Check Services Running in Linux Using “systemctl” Utility?
- How to Check Services Running on Linux Using “service” Command?
Method 1: How to Check Services Running in Linux Using “systemctl” Utility?
As discussed earlier, the “systemctl‘ utility is the most used to manage the services on Linux-based systems. Let’s see how it can be used to list down services:
List Down Machine Services
First of all, we are supposed to list down all the machine services using the systemctl command:
$ systemctl list-units --type=service --all
There are different states of the services, these can be loaded, running, or not found.
Check Running Services
To display all the running services, use the command:
$ systemctl list-units --type=service --state=running
All the services in a running state will be displayed on the screen.
List Down the Loaded Services
Similarly, to display all the loaded services, simply use the command:
$ systemctl list-units --type=service
Show the Enabled Services
Likewise, to display the enabled services, use the command:
$ systemctl list-unit-files --state=enabled
List Down Disabled Services
To display the disabled services, change the state in the above command:
$ systemctl list-unit-files --state=disabled
These are the different commands that can be used to display the status of the services using the systemctl utility.
Method 2: How to Check Services Running on Linux Using “service” Command?
Apart from the “systemctl” utility, another utility named “service” can also provide the list of services running in Linux.
List Down All Services
The following “service” command will list down all the services on the Linux system:
$ service --status-all
In the above figure, the services with the “+” sign are running on the system where the services with the “-” sign are not running on the system.
Check Running Services
To list down only the running services, use the command:
$ service --status-all | grep '\[ + \]'
Check Only Stopped Services
Likewise, to display the services which are not running but are installed on the system, use the command:
$ service --status-all | grep '\[ - \]'
In these ways, the running services can be checked on Ubuntu.
That’s all from this guide!
To check the services running on Linux, open the terminal and run the command “systemctl list-units –type=service –state=running”. The service command “service –status-all | grep ‘\[ + \]’” can also list all the running services on Linux. Apart from the running services, the “systemctl” utility and “service” command can also be used to list the stopped or all services. This post has provided all the possible commands to check services running in Linux.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY