How to Check Background Service Status in Ubuntu?

Managing system services is a fundamental task for maintaining a healthy Ubuntu environment. This article provides a quick guide on how to check the status of a specific background service using the standard systemctl command, explores variations for older systems, and explains how to interpret the output.


The Standard Command: systemctl

In modern versions of Ubuntu (15.04 and later), systemd is the default initialization system. The primary tool used to manage and check the status of services is systemctl.

To check the status of a specific background service, use the following syntax:

systemctl status service_name

For example, if you want to check the status of the Apache web server, you would run:

systemctl status apache2

This command does not require sudo privileges just to view the status, though modifying the service (like stopping or restarting it) will.


Understanding the Status Output

When you run the status command, Ubuntu provides a detailed breakdown of the service’s current state. The most critical pieces of information include:


Alternative Command for Older Ubuntu Versions

If you are maintaining an older legacy Ubuntu system that uses the SysVinit or Upstart systems (Ubuntu 14.04 and earlier), the systemctl command will not work. Instead, you must use the service command:

service service_name status

For example:

service mysql status

This command will output a shorter, more simplified status message indicating whether the process is currently running or stopped.