Previous versions of CentOS/RedHat Linux use init scripts located in the /etc/rc.d/init directory to start and stop services. In CentOS/RHEL 7, these init scripts have been replaced with systemd service units. Service units have a .service extension. Use the systemctl command as follows to list all loaded service units:

 # systemctl list-units --type service --all
  UNIT                                                            LOAD      ACTIVE   SUB     DESCRIPTION
  abrt-ccpp.service                                               loaded    inactive dead    Install ABRT coredump hook
  abrt-oops.service                                               loaded    inactive dead    ABRT kernel log watcher
  abrt-vmcore.service                                             loaded    inactive dead    Harvest vmcores for ABRT
  abrt-xorg.service                                               loaded    inactive dead    ABRT Xorg log watcher
  abrtd.service                                                   loaded    inactive dead    ABRT Automated Bug Reporting Tool 


Check status of service with systemd


1. systemd service units correspond to system services. Use the following command to display detailed information about a service unit. This example displays information about the ntpd.service service unit. You can omit the .service extension if you want.

 # systemctl status ntpd.service
● ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2017-08-26 15:01:55 IST; 2 months 20 days ago
 Main PID: 19984 (ntpd)
   CGroup: /system.slice/ntpd.service
           └─19984 /usr/sbin/ntpd -u ntp:ntp -g

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable. 


The following information is available for the specified service unit:

  • Loaded: If the service is loaded, the absolute path to the service unit file, and if the service unit is enabled
  • Active: If the service unit is running and a timestamp
  • Main PID: The Process ID of the corresponding system service and the service name
  • Status: Additional information about the corresponding system service
  • Process: Additional information about related processes
  • CGroup: Additional information about related Control Groups


The most recent log entries are displayed if the command is executed by the root user. You would see the status of the service in green (if running) or in red (if stopped).


2. To list the status of all services:

 # systemctl list-unit-files --type=service --all 


For Example :

 # systemctl list-unit-files --type=service
UNIT FILE                                     STATE
abrt-ccpp.service                             enabled
abrt-oops.service                             enabled
abrt-pstoreoops.service                       disabled
abrt-vmcore.service                           enabled
abrt-xorg.service                             enabled 


You should see the service in disabled mode highlighted with red color and the service in enabled mode highlighted with green color as show below.


Other commands to check the status of service


Use the following command to check whether a service is running (active) or not running (inactive):

# systemctl is-active sshd


Use the following command to check whether a service is enabled or disabled:

 # systemctl is-enabled sshd


# systemctl is-enabled httpd


Was this answer helpful? 0 Users Found This Useful (0 Votes)