chkconfig command in Linux with Examples
Last Updated :
23 Sep, 2024
'chkconfig' command is used to list all available services and view or update their run level settings. In simple words it is used to list current startup information of services or any particular service, update runlevel settings of service, and adding or removing service from management.
Here we’ll explore the syntax, options, and practical examples of using the 'chkconfig' command to help you gain full control over your system’s services.
Prerequisite: Run Levels in Linux
Syntax
chkconfig --list [name]
chkconfig --add name
chkconfig --del name
chkconfig --override name
chkconfig [--level levels] name
chkconfig [--level levels] name
Common Options used with the 'chkconfig' command
Here are some of the most common options available with the 'chkconfig' command:
Option | Description |
---|
--list | Lists the current status of all services or a specific service. |
--add name | Adds a new service to the startup sequence, allowing it to be managed by chkconfig . |
--del name | Removes a service from the startup sequence. |
--level levels | Specifies the run levels to enable or disable a service. |
--override name | Overrides the default settings for a service without affecting its configuration file |
Examples of Using the 'chkconfig' Command
Here are some practical examples that demonstrate how to use the chkconfig command in various scenarios.
1. List current status of all system services
To see a complete list of all services along with their current run level configurations, use the following command:
chkconfig --list

This will output a table showing which services are enabled or disabled at each run level.
2. View current status of a particular services
If you want to check the status of a particular service, such as rhnsd, use:
chkconfig --list rhnsd

This will display the run levels at which the rhnsd service is enabled or disabled.
3. Disabling a Service
By default 2 3 4 5 run levels are affected by this command to disable certain run levels only, add --level attribute followed by run level.
chkconfig rhnsd off

4. Enabling a Service
By default 2 3 4 5 run levels are affected by this command to enable certain run levels only, add --level attribute followed by run level.
chkconfig rhnsd on

5. Delete a Service
To completely remove a service from the startup sequence and prevent it from being managed by chkconfig, use:
chkconfig del rhnsd

6. Add a Service
If a service is not currently managed by chkconfig, you can add it to the startup sequence by running:
chkconfig add rhnsd

This ensures that the service is now manageable through the chkconfig utility and can be enabled or disabled as needed.
Conclusion
The chkconfig command is a powerful tool for managing system services and their run levels in Linux. By mastering this command, system administrators can control the startup behavior of services, optimize system performance, and enhance overall security.
Similar Reads
bzless command in Linux with examples bzless is a command similar to bzmore, but it has many more features. bzless does not have to read the entire input file before starting, so with a large file, it starts up faster than text editors like vi. bzless uses termcap (or terminfo on some systems), so it can run on a variety of terminals. S
2 min read
bzmore command in Linux with examples bzmore command in Linux is used as a filter for CRT viewing of bzip2 compressed files, which are saved with .bz2 suffix. In simple words, using 'bzmore', the content of the file can be viewed on the screen without uncompressing the file. bzip2 is a block-sorting file compressor which compresses file
3 min read
cal command in Linux with Examples The 'cal' command in Linux is a versatile tool that displays calendars directly in the terminal. If a user wants a quick view of the calendar in the Linux terminal, 'cal' is the command for you. Hereâs a look at the usage and features of 'cal' command in Linux.What is the 'cal' command?cal command i
2 min read
case command in Linux with examples The case command in Linux is an essential tool for simplifying script logic, especially when multiple if/elif conditions need to be evaluated for a single variable. It offers a more readable and efficient way to execute commands based on pattern matching, making your shell scripts easier to maintain
2 min read
How to View the Content of File in Linux | cat Command The cat command in Linux is more than just a simple tool, it's a versatile companion for various file-related operations, allowing users to view, concatenate, create, copy, merge, and manipulate file contents. Let's see the details of some frequently used cat commands, understanding each example alo
7 min read
cc command in Linux with Examples 'cc' command stands for C Compiler, usually an alias command to 'gcc' or 'clang'. As the name suggests, executing the 'cc' command will usually call the 'gcc' on Linux systems. It is used to compile the C language codes and create executables. The number of options available for the cc command is ve
3 min read
Encrypt/Decrypt Files in Linux using Ccrypt Ccrypt is a command line tool for encryption and decryption of data. Ccrypt is based on the Rijndael cipher, the same cipher used in the AES standard. On the other hand, in the AES standard, a 128-bit block size is used, whereas ccrypt uses a 256-bit block size. Ccrypt commonly uses the .cpt file ex
3 min read
How to Change the Directory in Linux | cd Command Navigating the Linux file system is like exploring a vast library; each directory (folder) holds its own collection of files and subdirectories, and knowing how to move between them efficiently is the first step to mastering the command line. The cd (Change Directory) command is your compass in this
7 min read
cfdisk command in Linux with examples cfdisk command is used to create, delete, and modify partitions on a disk device. It displays or manipulates the disk partition table by providing a text-based "graphical" interface. cfdisk /dev/sda Example: After running you get a prompt like this: Choose gpt from the list. Now you will see a parti
3 min read
chage command in Linux with examples The 'chage' command in Linux is a powerful tool used to manage user password expiry and account aging information. It is particularly useful in environments where user access needs to be controlled over time, such as when login access is time-bound or when itâs necessary to enforce regular password
4 min read