LinuxCommandLibrary

chkconfig

Manage system services at boot time

TLDR

List services with runlevel

$ chkconfig --list
copy

Show a service's runlevel
$ chkconfig --list [ntpd]
copy

Enable service at boot
$ chkconfig [sshd] on
copy

Enable service at boot for runlevels 2, 3, 4, and 5
$ chkconfig --level [2345] [sshd] on
copy

Disable service at boot
$ chkconfig [ntpd] off
copy

Disable service at boot for runlevel 3
$ chkconfig --level [3] [ntpd] off
copy

SYNOPSIS

chkconfig [--list [name]] | [--add name] | [--del name] | [--reset] | [--set name level on|off] | [name [levels [on|off|reset]]]

PARAMETERS

--add name
    Adds the specified service to the runlevel symlinks, enabling management.

--del name
    Removes the service from all runlevel directories.

--list [name]
    Lists runlevel info for all services or the specified service, showing on/off states.

--reset
    Resets all services to their default states as defined in init scripts.

--set name level on|off
    Sets the service state (on/off) for specific runlevels (e.g., 2345).

name on|off|reset
    Positional: Enables/disables/resets service at default runlevels (usually 2,3,4,5).

--level levels
    Specifies runlevels for actions (e.g., --level 35).

--help
    Displays usage summary.

--version
    Shows version information.

DESCRIPTION

chkconfig is a command-line utility for managing the startup behavior of system services in SysV init-based Linux distributions, such as older Red Hat, CentOS, and Fedora versions. It updates or queries runlevel information for services defined in /etc/init.d scripts, enabling administrators to control which services start at specific runlevels (e.g., multi-user mode, single-user mode). Runlevels define system states, like 3 for multi-user text mode or 5 for graphical mode.

Common tasks include listing service statuses across runlevels, adding or removing services from boot processes, and toggling states (on/off) for specific levels. For example, enabling a service at runlevels 3 and 5 ensures it starts during normal boot. The tool reads symbolic links in /etc/rc.d/rc[0-6].d/ directories to determine states (S for start, K for kill).

While powerful for legacy systems, chkconfig is deprecated on modern distributions using systemd, where systemctl provides equivalent functionality with target units replacing runlevels.

CAVEATS

Deprecated on systemd-based systems (e.g., RHEL 7+, Ubuntu 16.04+); use systemctl enable/disable instead. Requires SysV init scripts in /etc/init.d. Modifies symlinks—backup before changes.

COMMON USAGE EXAMPLES

chkconfig --list httpd
Lists Apache status per runlevel.

chkconfig httpd on
Enables httpd at runlevels 2,3,4,5.

chkconfig --level 35 mysqld on
Enables MySQL only at runlevels 3 and 5.

DEFAULT RUNLEVELS

Typically: 0=shutdown, 1=single-user, 2=multi-user no GUI, 3=multi-user text, 4=unused, 5=multi-user GUI, 6=reboot.

HISTORY

Developed in the 1990s for Red Hat Linux to simplify SysV init service management. Merged into chkconfig package, widely used in RPM-based distros until systemd adoption around 2010-2015. Maintained for compatibility but no active development.

SEE ALSO

Copied to clipboard