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
# 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:
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) as shown below.
# 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.
Use the following command to check whether a service is running (active) or not running (inactive):
# systemctl is-active sshd
active
Use the following command to check whether a service is enabled or disabled:
# systemctl is-enabled sshd
enabled
# systemctl is-enabled httpd
disabled