chkconfig command in Linux
What is the chkconfig command?
chkconfig is a simple command-line for handling the services at each running stage in the Linux command line. It is used to update and show the run level configuration for all available services.
In other words, it is used to update the services, current startup information, add or remove the service from management, update the runway settings of the service, and list of a particular service.
chkconfig commands
The following commands show the syntax of the chkconfig command and its available options.
S. No | Command syntax |
---|---|
1. | chkconfig –list [service_name] |
2. | chkconfig –override name |
3. | chkconfig –list | sort |
4. | chkconfig –del name |
5. | chkconfig [–level levels] name |
6. | chkconfig –add name |
1. Current status of all services
The following command indicates the status of starting and stopping all services. It is used to display the current status of all services.
2. Current status of all services in alphabetic order
3. Current status of particular services
This command shows the status of the starting and stopping of particular services. The command given below shows the startup configuration for a particular service. It is showing that HTTP services are closed in all run levels.
4. Enable (start) a particular service on run levels
This chkconfig command displays how you can start HTTP services at run level 3 parameters only. The “chkconfig -level 4 httpd on” command enables httpd services at run level 4.
The “chkconfig -list | grep httpd” command validates the status of httpd services running at the run level.
5. Disable (stop) a particular service on run levels
This chkconfig command displays how you can stop HTTP services at run level 4 parameters only.
This chkconfig command displays how you can stop HTTP services at multiple run levels.
6. Delete a service
The delete command completely deletes a service from the chkconfig system. This command removes the ‘nfs’ service from the chkconfig list.
7. Add a new service
This command adds a new service to chkconfig management. It adds a ‘nfs’ services, and it will automatically start at levels 1, 2, 3, 4 and 5.
The chkconfig command only adds those services that exist in your device. In case if a service does not exist in your device, then you should first install the package of that service, and then you should add that service to your device.