Ten ‘chkconfig’ Command Examples

chkconfig command is used to start, stop and view the status of all services running on the system. It allows you to display and change the services on your system at all levels. Let us see some basic commands in this short how-to.

1. Display the status of all services

To display the status of all available services in all runlevels, run the following command:

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

root@server:~_001

2. Display the status of running services

To display only the current running processes in all runlevels, enter the following command:

[[email protected] ~]# chkconfig --list | grep on

root@server:~_002

3. Display the status of running services at a particular runlevel

For instance, if you want to view the status of services in runlevel 3, run the following command:

[[email protected] ~]# chkconfig --list | grep 3:on

root@server:~_0034. View the status of a particular service

For instance if you want to see the status of rsyslog service in all runlevels, enter the following command:

[[email protected] ~]# chkconfig --list rsyslog
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off

or

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

5. Turn on or Start a service on system boot

For instance if you want to start the rsyslog service automatically on every reboot, enter the following command:

[[email protected] ~]# chkconfig rsyslog on

6. Turn off or Stop a service on system boot

To stop a service permanently enter the following command:

[[email protected] ~]# chkconfig rsyslog off

7. Start services at a particular runlevel

For instance, if you want to start a service at runlevel 3 and 5, enter the following command:

[[email protected] ~]# chkconfig --level 35 rsyslog on

8. Stop services at a particular runlevel

If you wanna to stop at particular runlevel, then command should be:

[[email protected] ~]# chkconfig --level 35 rsyslog off

9. Add a service to chkconfig

To add a service rsyslog to startup on all run levels, enter the following command:

[[email protected] ~]# chkconfig --add rsyslog

10. Remove a service from chkconfig

To remove a service from startup on all levels, the command should be:

[[email protected] ~]# chkconfig --del rsyslog

For more information about ‘chkconfig’ command refer the man pages with following command:

[[email protected] ~]# man chkconfig

root@server:~_004

Loading...