How to Use systemctl status Command to Check Service Status

Last updated: December 19, 2022

The systemctl is a command-line utility tool used to manage the systemd service. Systemd is a system and service manager for Linux operating systems. It is the new standard for managing Linux services.

Systemctl command is a lifesaver for Linux users and an absolute essential for managing services, daemons, and other processes running in the background on your machine. The command can list running services, start, stop, or restart them with ease. Plus, you can even check their logs to see what's going on and troubleshoot any issues that might arise.

One of the most commonly used commands that you can use with systemctl is the systemctl status. This guide is about how to use this command in a Linux environment.

Using the systemctl status command

The systemctl status command is the easiest way to get a snapshot of your Linux system's service's health. You can use it to quickly find out which services are running, and services that stopped or crashed. This is your go-to tool when you want to check the status of the services installed on your machine.

When using this command, you will just need to open your terminal and type in systemctl status [service_name.service].

Syntax:

systemctl status service_name 

Example:

systemctl status sshd
Using systemctl check status of a service

Understanding the output of the systemctl status command

Knowing how to interpret the output of the `systemctl status` command in Linux can be a powerful tool for troubleshooting any issues with your system. It provides helpful insights into the current state of various services and daemons, including their uptime and whether they're running properly.

The command will generate an abbreviated list of services on your system, along with their statuses. Let us look closely at the screenshot below.

explain output of systemctl status command

The screenshot above indicates the service being checked is ssh.service.

If you notice the green dot (.) before the service, this usually indicates that the service is active and running. The color changes depending on the service status. In most cases, the red color indicates that the service is stopped or inactive while green means active and running. The date and time shown in the same line indicate the time since the service has been in its current state.

Main PID: this is the process ID for this process. You can use ps command to verify.

Cgroup: Shows the control group to which this particular process belongs.

At the bottom of the system status output shows the journal logged events for the service.

Related Read: How to List Services in Linux Using Systemctl

Common options for systemctl status command

There are several options you can use when running the systemctl status command, depending on how much information you need.

  • -a - can be used to view all units
  • -l - can be used to view only those services that are in a running state.
  • -i - can be used to view more detailed information such as how long does service start-up or failed
  • -f - can be used to show information about a service's failed attempts. This is ideal for troubleshooting issues with one of your services.
  • -all - can be used to view all services and their current status.

Examples of using systemctl status command

Here are a few examples of using the systemctl status command:

Check the status of a specific service: `systemctl status myservice`

check service status of apache using systemctl

The output shows Apache webserver is active running since 14th Dec 2022 10:06:53 hours. In the same way, you can check the service status of other programs such Nginx, Mysql, etc.

Check the status of all services: `systemctl status --all`

systemctl status --all

Check the overall system state: 'systemctl status --full'

systemctl status --full

Conclusion

The systemctl status command is a one-stop shop for getting insight into what's wrong with your system. It gives you detailed information about processes and services that are running and can provide quick diagnoses of any issues they might be having.

SHARE

Comments

Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment