5 Basic chkconfig Command Examples in Linux
by Ravi Saive | Published: February 22, 2013 | Last Updated: January 3, 2015
Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators | 4 Free Shell Scripting eBooks
This is our ongoing Linux command series where we are going to review how we can use chkconfigcommand efficiently with it’s available parameters. The Chkconfig command tool allows to configure services start and stop automatically in the /etc/rd.d/init.d scripts through command line. Let’s see some examples.
1. List All Services
Using ‘–list‘ parameter will displayed all services and their current start-up status in each run-level configuration.
[root@tecmint ~]# chkconfig --list NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off abrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:off abrt-oops 0:off 1:off 2:off 3:on 4:off 5:on 6:off ...
2. Check Status of Specific Service
Below command shows startup configuration for a particular service. It’s showing HTTP services are turned off in all run levels.
[root@tecmint ~]# chkconfig --list | grep httpd httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
3. How Do I Start a Particular Service on Run Levels
The following ‘chkconfig‘ command shows how we can start HTTP services only on run level 3 and 5with ‘–level‘ parameter. First command starts httpd services on run level 3 and 5 and second command verifies the status of httpd services running on run level.
[root@tecmint ~]# chkconfig --level 35 httpd on
[root@tecmint ~]# chkconfig --list | grep httpd httpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
4. How to Check Which Services are On/Off
The following command will display all the services which are On and Off in specific run level 5.
[root@tecmint ~]# chkconfig --list | grep 5:on NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off abrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:off abrt-oops 0:off 1:off 2:off 3:on 4:off 5:on 6:off abrtd 0:off 1:off 2:off 3:on 4:off 5:on 6:off acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off ...
[root@tecmint ~]# chkconfig --list | grep 5:off dnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:off dovecot 0:off 1:off 2:off 3:off 4:off 5:off 6:off firstboot 0:off 1:off 2:off 3:off 4:off 5:off 6:off kdump 0:off 1:off 2:off 3:off 4:off 5:off 6:off mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off ...
5. How Do I Stop a Particular Service on Run Levels
The following command will turned Off a service called postfix for a just single run level. Similarly, we can turn Off a particular service in multiple run levels in one go as shown under.
[root@tecmint ~]# chkconfig --level 3 postfix off
[root@tecmint ~]# chkconfig --level 2345 postfix off
As we all know, there are seven run levels are available on Linux Operating System. We’ll cover the significant of different run levels and booting sequence in details in our upcoming article. So, please stay tuned.
If you have any questions or problems regarding this article and want help within 24 Hours? Ask Now
Support TecMint: Did you find this tutorial helpful?. Please help to keep it alive by donating. Every cent counts! - Donate Now
Ravi Saive
Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.
Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.
Receive Your Free Complimentary eBook NOW! - Beyond Linux® From Scratch - Version 6.3
- NEXT STORY6 WC Command Examples to Count Number of Lines, Words, Characters in Linux
- PREVIOUS STORYZend Framework 1.11.12 for PHP 5 on RHEL/CentOS 6.3/5.9 and Fedora 18-16
YOU MAY ALSO LIKE...
12 Practical Examples of Linux grep Command
1 NOV, 2013
4 RESPONSES
LEAVE A REPLY
DOWNLOAD FREE LINUX EBOOKS
- Complete Linux Command Line Cheat Sheet
- The GNU/Linux Advanced Administration Guide
- Securing & Optimizing Linux Servers
- Linux Patch Management: Keeping Linux Up To Date
- Introduction to Linux – A Hands on Guide
- Understanding the Linux® Virtual Memory Manager
- Linux Bible – Packed with Updates and Exercises
- A Newbie’s Getting Started Guide to Linux
- Linux from Scratch – Create Your Own Linux OS
- Linux Shell Scripting Cookbook, Second Edition
- Securing & Optimizing Linux: The Hacking Solution
- User Mode Linux – Understanding and Administration
$ chkconfig httpd –list