Different processes are running in the background of the Linux and making the RAM engaged with them. There are different command utilities with the help of which we can manage the services in Linux.
In this blog, the systemctl command line utility is used to display the services and also will explain the following topics:
- What is the systemctl Command Utility?
- How to List Services Using systemctl?
Let’s start with the basics of the systemctl utility.
What is the systemctl Command Utility in Linux?
The systemctl command utility is used to manage the services, such as restarting the service, displaying the status of the services, and stopping the services. The general syntax of using the systemctl command utility is:
$ sudo systemctl [Option] [Service name]
The different options like status, stop, start, and restart can be used with the systemctl command utility.
How to List Services Using the systemctl Command Utility in Linux?
The systemctl command can display the list of the services running on the computer and also the services which are stopped for a while. Different ways of listing down the services in Linux are explained with the help of examples.
Example 1: How to List Down All the Services on Linux?
The systemctl command utility can display all the services running on the machine by using the command:
$ systemctl list-units --type=service --all
All the services are being displayed on the screen whether they are running or not.
Example 2: How to List Down the Enabled Services on Linux?
Some services are enabled and ready to be used but are not running in the system. These services which are only enabled can be displayed using the command:
$ systemctl list-unit-files --state=enabled
All the enabled services are displayed on the screen.
Example 3: How to List Down the Loaded Services on Linux?
The services are loaded means the services are in an active state and also running on the computer. These services can be displayed using the systemctl command:
$ systemctl list-units --type=service
The loaded services are displayed on the screen.
Example 4: How to List Down the Running Services on Linux?
To display the running services, use the systemctl command given below:
$ systemctl list-units --type=service --state=running
All running services are displayed.
Example 5: How to List Down the Disabled Services on Linux?
The disabled services can be displayed on Linux using the following systemctl command:
$ systemctl list-unit-files --state=disabled
The disabled services are shown on the screen.
That’s how you can list down services using systemctl command.
To list down the services using the systemctl command utility on linux, run the “systemctl list-units –type=service –all” command. In this blog, different examples are used to explain the usage of the systemctl command for displaying the services.