Linux init命令 詳解
reboot可能是每個用過Linux的人都知道的命令,但有一個命令“init”才是命令中的精英。
最近有個同事學習安裝了CentOS,明明安裝的是帶桌面的系統,但是啟動后進入了命令行模式,搞不定了問到我,我執行了一下“init 5”,界面就出來了,那哥們頓時心生佩服,感覺好神奇。其實計算機這東西就是這樣子,不會的就感覺好神奇,當你會了,也就是那么回事。
Linux有個文件 /etc/inittab
# inittab This file describes how the INIT process should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> # 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:
說明
0是關機
1是單用戶
2是多用戶,不聯網
3是多用戶
4是不使用的
5是xwindows,也就是有界面的
6是重啟
用法
init命令很簡單。直接輸入init + 你想要的模式 回車就行。
比如 輸入 : init 0 就是關機
init 3 就是切換到多用戶
init 5 就是切換到界面
init 6 就是重啟
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點
疑難解答