The chkconfig command in Red Hat-based Linux distributions is used to manage the runlevel configuration of services, allowing you to specify which services should start or stop automatically at different runlevels. However, please note that with the transition to systemd, the chkconfig command is becoming less common, as systemd provides a more advanced way of managing services and their behavior. Table with information and examples related to the chkconfig command:
| Command | Description | Example |
|---|---|---|
chkconfig --list | List all available services and their current runlevel settings | chkconfig --list |
chkconfig --add | Add a service to the system’s list of managed services | chkconfig --add apache2 |
chkconfig --del | Remove a service from the list of managed services | chkconfig --del apache2 |
chkconfig --level | Configure a service to start or stop at a specific runlevel | chkconfig --level 3 apache2 on |
chkconfig | Configure a service to start at default runlevels | chkconfig apache2 on |
chkconfig | Configure a service to stop at all runlevels | chkconfig apache2 off |
Examples:
- List all available services and their current runlevel settings:
chkconfig --list- Add a service to the list of managed services:
chkconfig --add apache2- Remove a service from the list of managed services:
chkconfig --del apache2- Configure a service to start at a specific runlevel (e.g., runlevel 3):
chkconfig --level 3 apache2 on- Configure a service to start at default runlevels:
chkconfig apache2 on- Configure a service to stop at all runlevels:
chkconfig apache2 offRemember that modern Linux distributions, especially those using systemd, have shifted toward using systemctl for managing services. While chkconfig may still be available on some systems, it’s recommended to familiarize yourself with systemctl for a more comprehensive and modern approach to service management.