How To List Services In Linux?

A typical Linux system runs different services in order to complete or run different tasks. This service number is much higher in Linux servers for providing services to the other users. Linux services are used to remote access, file share, web server, etc. In some cases, Linux services are called daemons. But how can be list services in a Linux system?

Service Management Commands and Tools

In the last decade a lot of different commands and tools are created to manage services. The init.d was the first popular servie management tool where later service, systemctl emerged. Currently the systemctl command is the most complete and popular tool used to manage services. So init.d , service and systemctl commands can be used to list services where the services can be currently running, stopped or enabled for automatically starting.

List All Services

The systemctl command can be used to list all services by providing the –type=service option. If the –type=service option is not provided other management units will be also listed other than services.

systemctl --type=service

The service list can be navigated with the pageup and pagedown or arrow keys via keyboard. We can see that the following information about the service also listed.

  • UNIT is the name of the service canonical named which is used by systemctl command to identify service.
  • LOAD
  • ACTIVE
  • SUB lists if the service is currently running or exited or failed.
  • DESCRIPTION displays some basic information about the service.

List Running Services

Alternatively, we can list only running services from all services. We will use the systemctl command and provide the –type=service and –state=running options. The –state option is used to filter according to the service status like active, running, stopped.

systemctl --type=service --state=running
List Currently Running Services

From the output we can see that are listed service are in a active state and running.

List Stopped or Not Running Services

The stopped or currently not running services can be listed with the systemctl command by providing –state=exited option. Even the services are displayed active this means the service systemctl module is active. The status of the service is listed in the SUB column.

systemctl --type=service --state=exited
List Stopped Services

Create Bash Alias To List Services

Bash alias can be used to shorter commands or aliases inorder to list services. For example instead of typing “systemctl –type=service” command we can use service_list alias which will execute the “systemctl –type=service” command. The bash alias can be created in different ways but the most basic and permanent way is used the current user .bashrc file. First we will opened the .bashrc file.

nano ~/.bashrc

Then we will put the following line.

alias service_list ="systemctl --type=service"

and we will save changes. In order to work with the new alias named service_list, we should open a new tab or terminal. We will simply call the service_list like below.

service_list

Leave a Comment