How to List Services in Ubuntu Server / Desktop

In this tutorial we are going to learn how to list services in Ubuntu using the command line interface. We will see how we can list running services and services that are not running.

List Ubuntu Services with Service command

The service  --status-all command will list all services on your Ubuntu Server (Both running services and Not running Services).

service  --status-all

This will show all available services on your Ubuntu System. The status is [ + ] for running services, [ - ] for stopped services.

List Ubuntu Services with Service command

Using the grep command, we can filter the output to show only the running services.

service --status-all | grep '\[ + \]'

To list ubuntu services that are not running, Type,

service --status-all | grep '\[ - \]'

The service command can be used to list services in all Ubuntu releases, including (Ubuntu 17, 16.04, and 14.04).

List Services with systemctl command

Since Ubuntu 15, the services are managed by the systemd. With systemd we can use systemctl command to get information about running services in our Ubuntu system.

To list all running services on Ubuntu, Type:

systemctl list-units

The output of the command will look something like this:

UNIT                      LOAD   ACTIVE SUB       DESCRIPTION

apache2.service           loaded active running   LSB: Apache2 web server
apparmor.service          loaded active exited    LSB: AppArmor initialization
cron.service              loaded active running   Regular 
networking.service        loaded active exited    Raise network interfaces
nmbd.service              loaded active running   LSB: start Samba NetBIOS nameserver (nmbd)
smbd.service              loaded active running   LSB: start Samba SMB/CIFS daemon (smbd)
ssh.service               loaded active running   OpenBSD 

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

To list all services, including inactive units, Type:

systemctl list-units -a

To List inactive unit, Type:

systemctl list-units -a --state=inactive

The systemctl command does not work for Ubuntu 14.04 and earlier releases, instead use the service  --status-all command mentioned above.