Basic chkconfig Command Examples in Linux

Source: Internet
Author: User

ongoing Linux Command series where we are going to review how we can useChkconfigcommand efficiently with it ' s available parameters. The ChkconfigCommand tool allows to configure services start and stop automatically in the /ETC/RD.D/INIT.DScripts through command line. Let's see some examples.

1. List All Services

using '

[Email protected] ~]# chkconfig--listnetworkmanager  0:off   1:off   2:on    3:on    4:on 5:on 6:offabrt-ccpp       0:off   1:off   2:off   3:on    4:off   5:on    6:offabrt-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 is Turned off in the all run levels.

[Email protected] ~]# Chkconfig--list | grep httpdhttpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
3. How does I Start a particular Service on Run levels

The following 'Chkconfig' Command shows how we can startHTTPServices only on the run level3and5With '–level' Parameter. First command startshttpdServices on Run level3and5And second command verifies the status ofhttpdServices running on run level.

[Email protected] ~]# chkconfig--level httpd on
[Email protected] ~]# Chkconfig--list | grep httpdhttpd           0:off   1:off   2:off   3:on    4:off   5:on    6:off
4. How to Check which Services is on/off

The following command would display all the services which is onandOffIn specific run level5.

[[email protected] ~]# chkconfig--list |     grep 5:onnetworkmanager 0:off 1:off 2:on 3:on 4:on 5:on 6:offabrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:offabrt-oops 0:off 1:off 2:off 3:on 4:off 5:on 6:offabrtd 0:off 1:of F 2:off 3:on 4:off 5:on 6:offacpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off ... 
[[email protected] ~]# chkconfig--list | grep 5:offdnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:offdovecot 0:off 1:off 2:off 3:o FF 4:off 5:off 6:offfirstboot 0:off 1:off 2:off 3:off 4:off 5:off 6:offkdump 0:off 1:o      FF 2:off 3:off 4:off 5:off 6:offmysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:offnetconsole   0:off 1:off 2:off 3:off 4:off 5:off 6:offnfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off ... 
5. How does I Stop a particular Service on Run levels

The following command would turnedOffA service calledpostfixFor a just single run level. Similarly, we can turnOffA particular service in multiple run levels in one go as shown under.

[[email protected] ~]# chkconfig--level 3 postfix off
[[email protected] ~]# chkconfig--level 2345 postfix off 

As we all know, there is seven run levels is 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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.