If you need to view a list of all the services that are either running or stopped (or both) on an Ubuntu server, then you can use the following command:

1
service --status-all

This will print out a list of services that may look something like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# service --status-all
 [ - ]  acpid
 [ + ]  apache-htcacheclean
 [ + ]  apache2
 [ + ]  apparmor
 [ + ]  apport
 [ + ]  atd
 [ - ]  console-setup.sh
 [ + ]  cron
 [ - ]  cryptdisks
 [ - ]  cryptdisks-early
 [ + ]  datadog-agent
 [ + ]  datadog-agent-process
 [ + ]  datadog-agent-trace
 [ + ]  dbus
 [ - ]  docker

Only show Running Services in Ubuntu

If you are only interested in the running services, then we can filter by the [ + ] items:

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

This will show the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# service --status-all | grep '\[ + \]'
 [ + ]  apache-htcacheclean
 [ + ]  apache2
 [ + ]  apparmor
 [ + ]  apport
 [ + ]  atd
 [ + ]  cron
 [ + ]  datadog-agent
 [ + ]  datadog-agent-process
 [ + ]  datadog-agent-trace
 [ + ]  dbus
 [ + ]  ebtables

This prints out a reduced list of only the running services.

Only show Stopped Services in Ubuntu

The opposite is also true, we can also show a list of all stopped services:

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

This will show the following:

1
2
3
4
5
6
# service --status-all | grep '\[ - \]'
 [ - ]  acpid
 [ - ]  console-setup.sh
 [ - ]  cryptdisks
 [ - ]  cryptdisks-early
 [ - ]  docker