How to List All Services (Running | Stopped) on Ubuntu 16.04 | 18.04

This brief tutorial shows students and new users how to list or show all services either running or stopped on Ubuntu 16.04 | 18.04 LTS…

If you’re a student or new user looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS…. It’s a great Linux operating system for beginners..

Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other devices…

During your introduction to Ubuntu, you will find that Linux isn’t so different than Windows and other operating systems in so many ways, especially when it comes to using the system to get work done.…

Both Ubuntu and Windows systems allow you to be productive, easy to use, reliable and enable you to install and run thousands of programs from gaming to productivity suite software for individuals and businesses..

However, when you’re learning to use and understand Ubuntu Linux, you should also learn how to use the command line to terminal.. Most Linux users should be able to do some basic command line tasks.. This tutorial is going to show you how…..

When you’re ready to learn how list services on Ubuntu, follow the guide below:

About systemctl command:

On Linux systems, including Ubuntu the systemctl command utility that can be used to control and manage systemd services…. On Ubuntu 16.04, the service command can be use to accomplish the same..  Using both systemctl and service command, you can list all services either running, stopped or disabled…

Syntax:

The syntax is the rule and format of how the systemctl command can be used… These syntax options can be reordered, but a straight format must be followed.,.

Below is an example syntax of how to use the systemctl command….

systemctl [OPTIONS...] {COMMAND} ...

Options:

The command line options are switches or flags that determined how the commands are executed or controlled… they modify the behavior of the commands… they are separated by spaces and followed after the commands…

Below are some options of the systemctl command:

   COMMAND…Replace COMMAND….. with the name of the command service names.
-t –type=TYPE, –state=STATEUse the -t or –type or –state=STATE to list units of a particular type of service state: Active, Inactive
-a –all Use the -a or –all to show all properties/all units currently in memory,
including dead/empty ones. To list all units installed on
the system, use the ‘list-unit-files’ command instead.
-r –recursiveUse the -r or –recursive to show unit list of host and local containers
–helpDisplay a help message and exit.

 

Examples:

Below are some examples of how to run and use the systemctl on Ubuntu Linux…

Simply run the systemctl command to invoke it…

Starting and Stopping Services

To start or stop services using systemctl command, run the commands below:

sudo systemctl start application.service

To stop:

sudo systemctl stop application.service

You can also reference the application name without the ending .service

Example:

sudo systemctl start application

Restarting and Reloading

If you rather restart or reload you can run the commands below;

sudo systemctl restart application.service

Or reload:

sudo systemctl reload application.service

Reloading a service only reload configuration changes to a running service and won’t entirely restart the service… To fully restart a running service, you use the restart option..

Enabling and Disabling Services

If you want to disable or enable a service, you use the commands below: Enabling a service will allow that server to automatically start up everytime the server starts up… If you disable a service, the service will not run at all unless you reenable it..

sudo systemctl enable application.service

or disable:

sudo systemctl disable application.service

Check service status

To check the status of a service, you use the status option..

sudo systemctl status application.service

Listing all services:

To list all services running or stopped on the server, you run the commands below:

systemctl list-units --all --type=service --no-pager

That should list all service and output similar screen as below:

 UNIT                                  LOAD      ACTIVE   SUB     DESCRIPTION                                                 
  accounts-daemon.service               loaded    active   running Accounts Service                                            
  acpid.service                         loaded    active   running ACPI event daemon                                           
  alsa-restore.service                  loaded    active   exited  Save/Restore Sound Card State                               
  alsa-state.service                    loaded    inactive dead    Manage Sound Card State (restore and store)                 
  anacron.service                       loaded    inactive dead    Run anacron jobs                                            
  apparmor.service                      loaded    active   exited  AppArmor initialization                                     
  apport-autoreport.service             loaded    inactive dead    Process error reports when automatic reporting is enabled   
  apport.service                        loaded    active   exited  LSB: automatic crash report generation                      
  apt-daily-upgrade.service             loaded    inactive dead    Daily apt upgrade and clean activities                      
  apt-daily.service                     loaded    inactive dead    Daily apt download activities                               
● auditd.service                        not-found inactive dead    auditd.service                                              
  avahi-daemon.service                  loaded    active   running Avahi mDNS/DNS-SD Stack                                     
  bolt.service                          loaded    active   running Thunderbolt system service                                  
  colord.service                        loaded    active   running Manage, Install and Generate Color Profiles                 
● connman.service                       not-found inactive dead    connman.service

To list all inactive services, you run the commands below:

systemctl list-units --all --state=inactive

For only active services:

systemctl list-units --all --state=inactive

When you run systemctl with the –help option, you’ll see the help text below:

systemctl [OPTIONS...] {COMMAND} ...

Query or send control commands to the systemd manager.

  -h --help           Show this help
     --version        Show package version
     --system         Connect to system manager
     --user           Connect to user service manager
  -H --host=[USER@]HOST
                      Operate on remote host
  -M --machine=CONTAINER
                      Operate on local container
  -t --type=TYPE      List units of a particular type
     --state=STATE    List units with particular LOAD or SUB or ACTIVE state
  -p --property=NAME  Show only properties by this name
  -a --all            Show all properties/all units currently in memory,
                      including dead/empty ones. To list all units installed on
...............

If you’re running Ubuntu 16.04, you run the commands below:

service --status-all

That’s it!

Congratulations! You’ve learned how to use the systemctl to manage and list services on Ubuntu…

You may also like the commands below:

Install MyBB Forum Software on Ubuntu 18.04 | 16.04 With Apache2

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.