chkconfig command with examples in Linux / Unix

chkconfig command with examples in Linux / Unix

Chkconfig command is used to start and stop the linux services while the system boots. In our early post we have seen about linux OS booting process. All the linux service start up and service shutdown scripts are located in /etc/rc.d/ according to their runlevels. Chkconfig command is used to start and stop  the linux services according to the runlevel.

chkconfig command with examples in Linux / Unix

 

Lets see some examples of what chkconfig command can do

How to view status of all the services using chkconfig

chkconfig –list

To view chkconfig status of particular service

chkconfig –list | grep -i vsftpd

Another Method

chkconfig –list vsftpd

chkconfig command with examples in Linux / Unix

Turn on chkconfig service while system boots

chkconfig vsftpd on

Turn off chkconfig service while system boots

chkconfig vsftpd off

How to turn on a service in particular runlevel

chkconfig –level 5 mysqld on

How to turn off a service in particular runlevel

chkconfig –level 35 mysqld off

Turn on chkconfig service in multiple runlevel while system boots

chkconfig –level 135 vsftpd on

Turn off chkconfig service in multiple runlevel while system boots

chkconfig –level 135 vsftpd off

chkconfig command with examples in Linux / Unix

How to add a service in to chkconfig

chkconfig –add mysqld

How to delete a service from chkconfig

chkconfig –del mysqld

To know more about chkconfig command  use the below command

man chkconfig
help chkconfig
info chkconfig




One thought on “chkconfig command with examples in Linux / Unix

  1. Colin Guthrie

    This is a very recent article, but sadly it is quite out of date for most modern distros (including the Red Hat distro Fedora which is referred to in your first linked article, but also Mageia, Mandriva, Arch, Suse and many others and will be in the next version of RHEL/CentOS too).

    These distros now use systemd. It does away with chkconfig (except for compatibility) and the concept of “runlevels” generally (they are replaced but the much more power “targets” concept). You should generally favour systemctl for enabling and disabling services these days: www(dot)freedesktop(dot)org/software/systemd/man/systemctl.html

    See also www(dot)freedesktop(dot)org/wiki/Software/systemd/

    You should likely also add a note to your previous article too to clarify this.

    Reply

Leave a Reply

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