CentOS / RHEL: Check If A Service Is Running Or Not

See all Sun CentOS Linux related FAQs
How do I find out if a service such as MySQL or Apache running on my Centos/RHEL/Fedora Linux server?

You need to use service command. It runs a System V init script in as predictable environment as possible, removing most environment variables and with current working directory set to /. The syntax is as follows:
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements service command
Est. reading time 3 minutes

service SERVER status


/etc/init.d/SERVER status


Find, out if a service called mysqld (MySQL server) is running on CentOS OR RHEL. Open a terminal or login using ssh, enter:
# service mysqld status

Sample outputs:

mysqld (pid  7556) is running...

Find out status of all services

The service --status-all command runs all init scripts, in alphabetical order, with the status command:
# service --status-all
Sample outputs:

irqbalance (pid 2183) is running...
iscsi is stopped
iscsid is stopped
Kdump is operational
Adapter: ISA adapter
Ch. 0 DIMM 0: +63.0°C  (low  = +127.5°C, high = +127.5°C)  
Ch. 0 DIMM 1: +56.5°C  (low  = +127.5°C, high = +127.5°C)  
Ch. 1 DIMM 0: +62.0°C  (low  = +127.5°C, high = +127.5°C)  
Ch. 1 DIMM 1: +49.0°C  (low  = +127.5°C, high = +127.5°C)  
Ch. 2 DIMM 0: +54.0°C  (low  = +127.5°C, high = +127.5°C)  
Ch. 3 DIMM 0: +49.0°C  (low  = +127.5°C, high = +127.5°C)  
Adapter: ISA adapter
Core 0:      +37.0°C  (high = +78.0°C, crit = +100.0°C)  
Core 1:      +38.0°C  (high = +78.0°C, crit = +100.0°C)  
Core 2:      +34.0°C  (high = +78.0°C, crit = +100.0°C)  
Core 3:      +38.0°C  (high = +78.0°C, crit = +100.0°C)  
Adapter: ISA adapter
Core 0:      +40.0°C  (high = +78.0°C, crit = +100.0°C)  
Core 1:      +40.0°C  (high = +78.0°C, crit = +100.0°C)  
Core 2:      +39.0°C  (high = +78.0°C, crit = +100.0°C)  
Core 3:      +39.0°C  (high = +78.0°C, crit = +100.0°C)  
Adapter: ISA adapter
in0:         +4.08 V  (min =  +0.00 V, max =  +4.08 V)   
in1:         +4.08 V  (min =  +0.00 V, max =  +4.08 V)   
in2:         +4.08 V  (min =  +2.82 V, max =  +3.79 V)   ALARM
in3:         +3.07 V  (min =  +4.08 V, max =  +4.05 V)   ALARM
in4:         +3.12 V  (min =  +4.08 V, max =  +4.08 V)   ALARM
in5:         +3.15 V  (min =  +4.08 V, max =  +4.06 V)   ALARM
in6:         +3.20 V  (min =  +4.08 V, max =  +4.06 V)   ALARM
in7:         +3.28 V  (min =  +3.82 V, max =  +4.06 V)   ALARM
in8:         +3.28 V  (min =  +4.06 V, max =  +4.06 V)   ALARM
fan1:          0 RPM  (min =    0 RPM, div = 2)
fan2:          0 RPM  (min =    0 RPM, div = 2)
fan3:          0 RPM  (min =    0 RPM, div = 2)
temp1:       -48.0°C  (high = +60.0°C, hyst = +55.0°C)  sensor = thermistor
temp2:       -48.0°C  (high = +80.0°C, hyst = +75.0°C)  sensor = thermistor
temp3:       -48.0°C  (high = +80.0°C, hyst = +75.0°C)  sensor = thermistor
cpu0_vid:   +1.419 V
lvmetad is stopped
mdmonitor is stopped
memcached (pid  45560) is running...
messagebus (pid  7066) is running...
mysqld (pid  7556) is running...
netconsole module not loaded
Configured devices:
lo eth0 eth1
Currently active devices:
lo eth0 eth1
rpc.svcgssd is stopped
rpc.mountd (pid 7199) is running...
nfsd (pid 7262 7261 7260 7259 7258 7257 7256 7255) is running...
rpc.rquotad (pid 7195) is running...
rpc.statd (pid  2215) is running...
ntpd (pid  7295) is running...
master (pid  7649) is running...
Process accounting is enabled.
ipmi_msghandler module not loaded.
ipmi_si module not loaded.
ipmi_devintf module not loaded.
/dev/ipmi0 does not exist.
quota_nld is stopped
rdisc is stopped

ps or pgrep command

You can use ps or pgrep command as follows to find out if service is running or not on RHEL/Centos:
# ps aux | grep 'serviceNameHere'
# ps aux | grep 'mysqld'

# pgrep serviceNameHere
## match user name ##
# pgrep -u userName serviceNameHere
# pgrep mysqld
# pgrep -u mysql mysqld

Starting service

Say if a service called httpd is not running on server and you wish to start the same:
# service httpd status
## if httpd is not running start it ##
# chkconfig httpd on
# service httpd start


For more information see man pages – .

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

9 comments… add one
  • Jalal Hajigholamali Jun 10, 2013 @ 2:50

    Thanks for nice article

    some services create a file under /var/run when starting
    for example vsftpd.pid or atd.pid

    we can check existence of these files

  • Zdenek Styblik Jun 10, 2013 @ 7:09


    I think there is a typo. At first it’s said to use “service SERVER stats” or “/etc/init.d/SERVER stats”. However, later it’s shown to use ‘status’, eg. “# service mysqld status”. I believe the latter is correct and former wrong.


  • meow Jun 10, 2013 @ 14:50

    expecting RHEL 7 along with systemd

  • Angelos Jul 10, 2013 @ 13:11

    If only reality would be always so rosy !

    There are cases where a service is wedged so badly that even if you give it a service status command , the output well lead you astray. Say for example openVPN , if it is wedged the only way to find out is to Ping another server.
    Other times some custom init scripts, first trample the PID file before issuing a real start command. In that case subsequent status commands will give you errors.

    So please use the output of the various service status commands as advice not as the real status, there will be cases that you will need to debug further.

    Good Luck

  • sandy Sep 21, 2013 @ 17:55

    HI guys am new to linux, so Help me
    How to get details (for a web server) those who came and access the pages and what are all the services running and from which time it(services) started to run?

    Thanks for resolve this

  • Gaurav Bhayana Dec 13, 2013 @ 10:33

    Hi Team

    Please rectify this post. Below mentioned command doesn’t exist in RHEL / CenrOS / Fedora.

    service SERVER stats
    /etc/init.d/SERVER stats

    It should be

    service status
    /etc/init.d/ status

    • Gaurav Bhayana Dec 13, 2013 @ 10:35

      It should be

      service service-name status
      /etc/init.d/service-name status

      • Varun Jan 8, 2016 @ 0:46

        Yeah.. That`s correct !! Thanks @Gaurav

        # service service-name status
        # /etc/init.d/service-name status

  • aref ghobadi Aug 16, 2015 @ 10:53

    Thanks for nice article

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.