How To List Services in Ubuntu – A Brief Guide

Ubuntu List Services Techhyme

In Ubuntu, services refer to background processes that run on a system, even when no user is logged in. Some examples of commonly used services in Ubuntu include:

  • Apache Web Server
  • SSH
  • MySQL/MariaDB
  • CUPS (Print server)
  • Samba (File sharing)
  • Postfix (Mail server)
  • NTP (Network Time Protocol)

You can manage these services using the systemctl command, which allows you to start, stop, restart, enable, or disable a service.

To list all services unit files execute the bellow command from your terminal:

Command: systemctl list-units –all –type=service –no-pager

Ubuntu List Services Techhyme

The following command will display all available systemd unit files regardless of their state and type:

Command: systemctl list-unit-files –no-pager

Ubuntu List Services Techhyme

You can also use grep command in case you are searching for a specific unit file.

Command: systemctl list-unit-files –no-pager | grep apache2

Ubuntu List Services Techhyme

The systemctl command can be used to list all active running services:

Command: systemctl list-units –all –type=service –no-pager | grep running

Ubuntu List Services Techhyme

To display all exited service execute:

Command: systemctl list-units –all –type=service –no-pager | grep exited

Ubuntu List Services Techhyme

Furthermore, to show all stopped/dead systemd services execute:

Command: systemctl list-units –all –type=service –no-pager | grep dead

Ubuntu List Services Techhyme

The following systemctl command will list all enabled services:

Command: systemctl list-unit-files | grep enabled

Ubuntu List Services Techhyme

On the other hand to list all disabled services execute:

Command: systemctl list-unit-files | grep disabled

Ubuntu List Services Techhyme

Use the systemctl command to set the service state as enabled or disabled. For example the following command will enable the Apache2 service to start during the system boot startup:

Command: systemctl enable apache2

Ubuntu List Services Techhyme

And to disable the apache2 service, you can type:

Command: systemctl disable apache2

Ubuntu List Services Techhyme
To manage services in Ubuntu, you can use the systemctl command, which is part of the systemd system and service manager. This tool provides a convenient way to manage system services, including starting, stopping, restarting, enabling, and disabling them.

Here are some common tasks you can perform using systemctl:

  • Start a service: sudo systemctl start [service-name]
  • Stop a service: sudo systemctl stop [service-name]
  • Restart a service: sudo systemctl restart [service-name]
  • Enable a service to start automatically at boot: sudo systemctl enable [service-name]
  • Disable a service from starting automatically at boot: sudo systemctl disable [service-name]
  • Check the status of a service: sudo systemctl status [service-name]

You can find a list of all available services on your system by using the systemctl list-units command. This will display a list of all units, including services, sockets, devices, etc. To view only the services, you can use the following command: systemctl list-units –type=service.

You may also like:

Related Posts

Leave a Reply