How To Check and List All Services in CentOS/RHEL(6/7/8) Linux

This post will guide you how to check the status of a service in your CentOS or RHEL Linux system. How do I list all running services in CentOS/RHEL 6/7/8 Linux.

How To Check and List All Services in CentOSRHEL Linux 1

List All Running Services on CentOS 6


If you want to list all running services on your CentOS /RHEL 6 Linux system, and you can use service command with --status-all option, type:

$ service --status-all
$ service --status-all | less

Outputs:

[root@devops ~]# service --status-all| less
Stopped
cgred is stopped
crond (pid 1401) is running...
htcacheclean is stopped
httpd (pid 20286) is running...
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all ::/0 ::/0 state RELATED,ESTABLISHED
2 ACCEPT icmpv6 ::/0 ::/0
3 ACCEPT all ::/0 ::/0
4 ACCEPT udp ::/0 fe80::/64 state NEW udp dpt:546
5 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:22
6 REJECT all ::/0 ::/0 reject-with icmp6-adm-prohibited

Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all ::/0 ::/0 reject-with icmp6-adm-prohibited

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
......

Check Status of a Service on CentOS 6


If you want to check the status of a service (such as: httpd serivce ) in CentOS or RHEL 6 Linux,you can use one of the following command:

$ service httpd status

or

$ /etc/init.d/httpd status

Outputs:

[root@devops ~]# service httpd status
httpd (pid 20286) is running...
[root@devops ~]# /etc/init.d/httpd status
httpd (pid 20286) is running...

List All Running Services on CentOS 7/8


If you want to list all running services in CentOS 7 or CentOS 8 system, and you can use the below systemctl command, type:

$ systemctl list-units --type=service

Outputs:

[devops@mydevops ~]$ systemctl list-units --type=service
UNIT LOAD ACTIVE SUB DESCRIPTION
accounts-daemon.service loaded active running Accounts Service
alsa-state.service loaded active running Manage Sound Card State (restore and>
atd.service loaded active running Job spooling tools
auditd.service loaded active running Security Auditing Service
avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
bolt.service loaded active running Thunderbolt system service
chronyd.service loaded active running NTP client/server
colord.service loaded active running Manage, Install and Generate Color P>
crond.service loaded active running Command Scheduler
......

[devops@mydevops ~]$ systemctl list-units --type=service | wc -l
71

To list all services in your system, you can type the following command:

$ systemctl list-unit-files

Outputs:

[devops@mydevops ~]$ systemctl list-unit-files |less
UNIT FILE STATE
proc-sys-fs-binfmt_misc.automount static
-.mount generated
boot.mount generated
dev-hugepages.mount static
dev-mqueue.mount static
home.mount generated
proc-fs-nfsd.mount static
proc-sys-fs-binfmt_misc.mount static
sys-fs-fuse-connections.mount static
sys-kernel-config.mount static
......

[devops@mydevops ~]$ systemctl list-unit-files | wc -l
414

Check Status of a Service on CentOS 7/8


If you want to check the status of a service named httpd in your CentOS or RHEL 7/8 Linux system, just run the following command:

$ systemctl status httpd.service

Outputs:

[devops@mydevops ~]$ systemctl status httpd.service
 httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2019-10-12 06:23:25 EDT; 2s ago
Docs: man:httpd.service(8)
Main PID: 3199 (httpd)
Status: "Started, listening on: port 80"
Tasks: 213 (limit: 8297)
Memory: 29.4M
CGroup: /system.slice/httpd.service
├─3199 /usr/sbin/httpd -DFOREGROUND
├─3208 /usr/sbin/httpd -DFOREGROUND
├─3209 /usr/sbin/httpd -DFOREGROUND
├─3210 /usr/sbin/httpd -DFOREGROUND
└─3211 /usr/sbin/httpd -DFOREGROUND

Oct 12 06:23:24 mydevops.com systemd[1]: Starting The Apache HTTP Server...
Oct 12 06:23:25 mydevops.com httpd[3199]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using mydevops.com.>
Oct 12 06:23:25 mydevops.com httpd[3199]: Server configured, listening on: port 80
Oct 12 06:23:25 mydevops.com systemd[1]: Started The Apache HTTP Server.

To check a service named httpd if it is running or enabled in your system, and you can use the below commands:

$ systemctl is-active httpd
$ systemctl is-enabled httpd

Outputs:

[devops@mydevops ~]$ systemctl is-active httpd
active

[devops@mydevops ~]$ systemctl is-enabled httpd
disabled

Conclusion


You should know that how to list all running services or check the stauts of a given service in your CentOS/RHEL/ 6/7/8 Linux.

You might also like:

Sidebar



back to top