Linux init命令 詳解
reboot可能是每個(gè)用過(guò)Linux的人都知道的命令,但有一個(gè)命令“init”才是命令中的精英。
最近有個(gè)同事學(xué)習(xí)安裝了CentOS,明明安裝的是帶桌面的系統(tǒng),但是啟動(dòng)后進(jìn)入了命令行模式,搞不定了問(wèn)到我,我執(zhí)行了一下“init 5”,界面就出來(lái)了,那哥們頓時(shí)心生佩服,感覺(jué)好神奇。其實(shí)計(jì)算機(jī)這東西就是這樣子,不會(huì)的就感覺(jué)好神奇,當(dāng)你會(huì)了,也就是那么回事。
Linux有個(gè)文件 /etc/inittab
# inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, <[email protected]> # Modified for RHS Linux by Marc Ewing and Donnie Barnes # # Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) #id:3:initdefault:
說(shuō)明
0是關(guān)機(jī)
1是單用戶
2是多用戶,不聯(lián)網(wǎng)
3是多用戶
4是不使用的
5是xwindows,也就是有界面的
6是重啟
用法
init命令很簡(jiǎn)單。直接輸入init + 你想要的模式 回車就行。
比如 輸入 : init 0 就是關(guān)機(jī)
init 3 就是切換到多用戶
init 5 就是切換到界面
init 6 就是重啟
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選