Basic chkconfig Command Examples in Linux
2014-05-11 21:24
645 查看
This is our ongoing Linux command series where we are going to review how we can usechkconfigcommand efficiently with it’s available parameters. TheChkconfigcommand 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 ‘–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 showingHTTPservices are turnedoffin 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 startHTTPservices only on run level3and5with ‘–level‘ parameter. First command startshttpdservices on run level3and5and second command verifies the status ofhttpdservices 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 areOnandOffin specific run level5.[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 turnedOffa service calledpostfixfor a just single run level. Similarly, we can turnOffa 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 offAs 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.
相关文章推荐
- 15 Basic ‘ls’ Command Examples in Linux
- 15 Basic ‘ls’ Command Examples in Linux
- 15 Basic ‘ls’ Command Examples in Linux
- 13 Basic Cat Command Examples in Linux
- linux_13 Basic Cat Command Examples in Linux
- Find command usage in Linux with excellent examples--reference
- HowTo: Use grep Command In Linux / UNIX – Examples
- 15 Practical Grep Command Examples In Linux / UNIX
- 15 Practical Grep Command Examples In Linux / UNIX
- basic examples of linux netstat command
- 15 Practical Grep Command Examples In Linux / UNIX
- How to Mount and Unmount Filesystem / Partition in Linux (Mount/Umount Command Examples)
- 15 Practical Grep Command Examples In Linux / UNIX
- 10 examples to help you understand top command usage in Unix/Linux
- How to find PID of process listening on a port in Linux? netstat and lsof command examples
- HowTo: Use grep Command In Linux / UNIX – Examples
- Find command usage in Linux with excellent examples--reference
- How To Use Ip Command In Linux with Examples