5 Basic chkconfig Command Examples in Linux

This is our ongoing Linux command series where we are going to review how we can use chkconfig command efficiently with it’s available parameters. The Chkconfig command tool allows to configure services start and stop automatically in the /etc/rd.d/init.d scripts through command line. Let’s see some examples.

chkconfig command examples

5 chkconfig command examples

1. List All Services

Using ‘–list‘ parameter will displayed all services and their current start-up status in each run-level configuration.

[[email protected] ~]# chkconfig --list

NetworkManager  0:off   1:off   2:on    3:on    4:on    5:on    6:off
abrt-ccpp       0:off   1:off   2:off   3:on    4:off   5:on    6:off
abrt-oops       0:off   1:off   2:off   3:on    4:off   5:on    6:off
...

2. Check Status of Specific Service

Below command shows startup configuration for a particular service. It’s showing HTTP services are turned off in all run levels.

[[email protected] ~]# chkconfig --list | grep httpd
httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off

3. How Do I Start a Particular Service on Run Levels

The following ‘chkconfig‘ command shows how we can start HTTP services only on run level 3 and 5 with ‘–level‘ parameter. First command starts httpd services on run level 3 and 5 and second command verifies the status of httpd services running on run level.

[[email protected] ~]# chkconfig --level 35 httpd on
[[email protected] ~]# chkconfig --list | grep httpd
httpd           0:off   1:off   2:off   3:on    4:off   5:on    6:off

4. How to Check Which Services are On/Off

The following command will display all the services which are On and Off in specific run level 5.

[[email protected] ~]# chkconfig --list | grep 5:on
NetworkManager  0:off   1:off   2:on    3:on    4:on    5:on    6:off
abrt-ccpp       0:off   1:off   2:off   3:on    4:off   5:on    6:off
abrt-oops       0:off   1:off   2:off   3:on    4:off   5:on    6:off
abrtd           0:off   1:off   2:off   3:on    4:off   5:on    6:off
acpid           0:off   1:off   2:on    3:on    4:on    5:on    6:off
...
[[email protected] ~]# chkconfig --list | grep 5:off
dnsmasq         0:off   1:off   2:off   3:off   4:off   5:off   6:off
dovecot         0:off   1:off   2:off   3:off   4:off   5:off   6:off
firstboot       0:off   1:off   2:off   3:off   4:off   5:off   6:off
kdump           0:off   1:off   2:off   3:off   4:off   5:off   6:off
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
nfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off
...

5. How Do I Stop a Particular Service on Run Levels

The following command will turned Off a service called postfix for a just single run level. Similarly, we can turn Off a particular service in multiple run levels in one go as shown under.

[[email protected] ~]# chkconfig --level 3 postfix off
[[email protected] ~]# chkconfig --level 2345 postfix off

As we all know, there are seven run levels are available on Linux Operating System. We’ll cover the significant of different run levels and booting sequence in details in our upcoming article. So, please stay tuned.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

10 Responses

  1. Nagarajan J says:

    Is the run level 0 and 6 require for service?

    Ex: chkconfig –level 02356 servicename on

    May I know the reason for 0 and 6 levels to assign the particular service.

    Thanks & Regards,
    Nagarajan J

  2. shivendra says:

    wrong path has been gives, please correct it to /etc/rc.d/init.d/

  3. Kandhanadhan says:

    Sir, I need to know the way to find out the service name and daemon name for a particular package. Example for samba package alone, it has to show the service name smb and daemon name smbd.

    Thanks in advance

  4. Glitter says:

    very informative article and simple to understand

  5. shashi says:

    Nice post, thanks.

  6. Sandy6933 says:

    Nice post…Its so easy to understand!

    Thank you very much for the hardwork :)

  7. Keltron3030 says:

    Current Introduction typo to be corrected for directory path of RC scripts; /etc/rd.d/init.d

    The Chkconfig command tool allows to configure services start and stop automatically in the /etc/rd.d/init.d scripts through command line. Let’s see some examples.

    Corrected directory path of RC scripts; /etc/rc.d/init.d

  8. Shepp says:

    #2 could be better written as…
    $ chkconfig httpd –list

    6 less keystrokes is a win in my book :)

Leave a Reply to Keltron3030 Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.