linux中的开机和关机命令
與關(guān)機(jī)、重新啟動(dòng)相關(guān)的命令
?* 將數(shù)據(jù)同步寫(xiě)入硬盤(pán)中的命令? sync
?* 慣用的關(guān)機(jī)命令? shutdown
?* 重新啟動(dòng)、關(guān)機(jī)? reboot halt poweroff
?sync 強(qiáng)制將內(nèi)存中的數(shù)據(jù)寫(xiě)入到硬盤(pán)當(dāng)中。因?yàn)閘inux系統(tǒng)中,數(shù)據(jù)會(huì)緩存在內(nèi)存當(dāng)中,所以為了保證數(shù)據(jù)完整保存在硬盤(pán)中,通常會(huì)在關(guān)機(jī)前使用sync命令,強(qiáng)制將內(nèi)存中的數(shù)據(jù)寫(xiě)入到緩存中。但是一般情況下,我們使用shutdown ,halt命令時(shí),系統(tǒng)會(huì)自動(dòng)調(diào)用 sync 命令,將緩存寫(xiě)入硬盤(pán)后再關(guān)機(jī)。
?shutdown 根據(jù)目前已啟動(dòng)的服務(wù)逐次關(guān)閉各項(xiàng)服務(wù)后才關(guān)機(jī);
?halt? 可以在不理會(huì)系統(tǒng)的情況下,進(jìn)行硬件關(guān)機(jī);
?
NAME
?????? shutdown - Halt, power-off or reboot the machine
SYNOPSIS
?????? shutdown [OPTIONS...] [TIME] [WALL...]
?????? shutdown 參數(shù)?? 時(shí)間字段? 通知(wall message 也可以叫大字報(bào))
DESCRIPTION
?????? shutdown may be used to halt, power-off or reboot the machine.
?????? shutdown 用于關(guān)閉、重啟服務(wù)器
?????? The first argument may be a time string (which is usually "now"). Optionally, this may be followed by a wall message to
?????? be sent to all logged-in users before going down.
?????? 第一個(gè)參數(shù)可以是一個(gè)關(guān)于時(shí)間的字段(通常是 now).通常,后面會(huì)跟一個(gè)消息,這個(gè)消息會(huì)在執(zhí)行命令前被發(fā)送給每一個(gè)使用者。
?????? The time string may either be in the format "hh:mm" for hour/minutes specifying the time to execute the shutdown at,
?????? specified in 24h clock format. Alternatively it may be in the syntax "+m" referring to the specified number of minutes m
?????? from now.? "now" is an alias for "+0", i.e. for triggering an immediate shutdown. If no time argument is specified, "+1"
?????? is implied.時(shí)間字段 time string 也可以是格式化的時(shí)間 (hh:mm),表示在多長(zhǎng)時(shí)間之后關(guān)閉服務(wù)器,時(shí)間使用24h制。+m 表示從現(xiàn)在開(kāi)始幾分鐘之后關(guān)閉服務(wù)器。'now'表示時(shí)間是0,立即觸發(fā)shutdown.如果沒(méi)有指明參數(shù),默認(rèn)在一分鐘之后關(guān)閉服務(wù)器。
?????? Note that to specify a wall message you must specify a time argument, too.
?????? 記得指明時(shí)間參數(shù)的時(shí)候也指明(wall message) 標(biāo)語(yǔ)。
?????? If the time argument is used, 5 minutes before the system goes down the /run/nologin file is created to ensure that
?????? further logins shall not be allowed.
?????? 時(shí)間參數(shù)被確定之后,系統(tǒng)在服務(wù)器關(guān)閉前五分鐘內(nèi)不在允許用戶登錄。
OPTIONS
?????? The following options are understood:
?????? --help
?????????? Print a short help text and exit.
?????? -H, --halt
?????????? Halt the machine. 關(guān)閉服務(wù)器
?????? -P, --poweroff
?????????? Power-off the machine (the default).
?????? -r, --reboot
?????????? Reboot the machine.
?????? -h
?????????? Equivalent to --poweroff, unless --halt is specified. 等價(jià)于
?????? -k
?????????? Do not halt, power-off, reboot, just write wall message. 僅僅寫(xiě)wall message,不用關(guān)閉、重啟服務(wù)器。
?????? --no-wall
?????????? Do not send wall message before halt, power-off, reboot. 關(guān)閉、重啟服務(wù)器之前不發(fā)送wall message
?????? -c
?????????? Cancel a pending shutdown. This may be used cancel the effect of an invocation of shutdown with a time argument that
?????????? is not "+0" or "now". 取消關(guān)閉服務(wù)器 通常之前執(zhí)行的關(guān)機(jī)命令,它的時(shí)間參數(shù)不是 +0 或 ‘now’
EXIT STATUS
?????? On success, 0 is returned, a non-zero failure code otherwise.
SEE ALSO
?????? systemd(1), systemctl(1), halt(8), wall(1)
systemd 219
?
halt 關(guān)機(jī)但不關(guān)閉電源
halt -p 關(guān)機(jī)并且關(guān)閉電源
運(yùn)行等級(jí)的切換
?* run level 0 : 關(guān)機(jī)
?* run level 3 : 純文本模式
?* run level 5 : 含有圖形接口模式
?* run level 6 : 重新啟動(dòng)
使用 init 0 也可以關(guān)機(jī)
轉(zhuǎn)載于:https://www.cnblogs.com/picap00n/p/linux_shutdown.html
總結(jié)
以上是生活随笔為你收集整理的linux中的开机和关机命令的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 家人们,第一次去海南旅游要吃椰小鸡吗?
- 下一篇: 65寸以上电视价格为啥翻倍?