linux中的开机和关机命令
与关机、重新启动相关的命令
* 将数据同步写入硬盘中的命令 sync
* 惯用的关机命令 shutdown
* 重新启动、关机 reboot halt poweroff
sync 强制将内存中的数据写入到硬盘当中。因为linux系统中,数据会缓存在内存当中,所以为了保证数据完整保存在硬盘中,通常会在关机前使用sync命令,强制将内存中的数据写入到缓存中。但是一般情况下,我们使用shutdown ,halt命令时,系统会自动调用 sync 命令,将缓存写入硬盘后再关机。
shutdown 根据目前已启动的服务逐次关闭各项服务后才关机;
halt 可以在不理会系统的情况下,进行硬件关机;
NAME
shutdown - Halt, power-off or reboot the machine
SYNOPSIS
shutdown [OPTIONS...] [TIME] [WALL...]
shutdown 参数 时间字段 通知(wall message 也可以叫大字报)
DESCRIPTION
shutdown may be used to halt, power-off or reboot the machine.
shutdown 用于关闭、重启服务器
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.
第一个参数可以是一个关于时间的字段(通常是 now).通常,后面会跟一个消息,这个消息会在执行命令前被发送给每一个使用者。
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.时间字段 time string 也可以是格式化的时间 (hh:mm),表示在多长时间之后关闭服务器,时间使用24h制。+m 表示从现在开始几分钟之后关闭服务器。'now'表示时间是0,立即触发shutdown.如果没有指明参数,默认在一分钟之后关闭服务器。
Note that to specify a wall message you must specify a time argument, too.
记得指明时间参数的时候也指明(wall message) 标语。
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.
时间参数被确定之后,系统在服务器关闭前五分钟内不在允许用户登录。
OPTIONS
The following options are understood:
--help
Print a short help text and exit.
-H, --halt
Halt the machine. 关闭服务器
-P, --poweroff
Power-off the machine (the default).
-r, --reboot
Reboot the machine.
-h
Equivalent to --poweroff, unless --halt is specified. 等价于
-k
Do not halt, power-off, reboot, just write wall message. 仅仅写wall message,不用关闭、重启服务器。
--no-wall
Do not send wall message before halt, power-off, reboot. 关闭、重启服务器之前不发送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". 取消关闭服务器 通常之前执行的关机命令,它的时间参数不是 +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 关机但不关闭电源
halt -p 关机并且关闭电源
运行等级的切换
* run level 0 : 关机
* run level 3 : 纯文本模式
* run level 5 : 含有图形接口模式
* run level 6 : 重新启动
使用 init 0 也可以关机
linux中的开机和关机命令的更多相关文章
- linux中常用的60个命令及作用详解
Linux 必学的 60 个命令 Linux 提供了大量的命令,利用它可以有效地完成大量的工作,如磁盘操作.文件存取.目录操作.进程管理.文件权限设定等.所以,在 Linux 系统上工作离不开使用系统 ...
- Linux课程---12、linux中内存指令(top命令的作用是什么)
Linux课程---12.linux中内存指令(top命令的作用是什么) 一.总结 一句话总结: top实时观察进程.内存和CPU情况 1.电脑出现反应慢情况,最先想到的是什么? 内存 2.linux ...
- Linux中程序开机自启
Linux中程序开机自启 https://www.itbulu.com/debian-ubuntu-rclocal.html
- Linux中系统检测工具top命令
Linux中系统检测工具top命令 本文转自:https://www.cnblogs.com/zhoug2020/p/6336453.html 首先介绍top中一些字段的含义: VIRT:virtua ...
- linux中没有dos2UNIX或者UNIX2dos命令怎么解决办法
linux中没有dos2UNIX或者UNIX2dos命令怎么解决办法 http://blog.csdn.net/w616589292/article/details/38274475 dos2unix ...
- linux中Jenkins启动/重启/停止命令
简要记录一下Linux 中Jenkins启动/重启/停止命令 启动service jenkins start1重启service jenkins restart1停止service jenkins s ...
- 详解Linux中的cat文本输出命令用法
作系统 > LINUX > 详解Linux中的cat文本输出命令用法 Linux命令手册 发布时间:2016-01-14 14:14:35 作者:张映 我要评论 这篇 ...
- Linux中常见的150个命令(干货)
目录 线上查询及帮助命令 文件和目录操作命令 查看文件和内容处理命令 文件压缩及解压缩命令 信息显示命令 搜索文件命令 进程管理相关命令 用户管理命令 基础网络操作命令 深入网络操作命令 有关磁盘与文 ...
- 3、Linux 获取帮助的方法-关机命令-7个系统启动级别
1.获取帮助的方法: (1).命令 -h 或--help (2).man man 命令 --->/user 查看user选项 /选项 ---->n 查看下一项 2.关机命令 (1).sh ...
随机推荐
- win7 共享问题,"您可能没有权限使用网络资源"
原文:http://hi.baidu.com/celian521/item/81b16e7c59996e295d178946 1 打开受访者的guest权限2 开始--运行--gpedit.msc3 ...
- oracle 左边填充函数使用
左边填充 select lpad('abcde',10,'0') from dual; ==>00000abcde select lpad('abcde',10,'x') from dual;= ...
- Spring AOP 简单理解
AOP技术即(面向切面编程)技术是在面向对象编程基础上的发展,AOP技术是对所有对象或一类对象编程.核心是在不增加代码的基础上,还增加了新的功能.AOP编程在开发框架本身用的比较多,而实际项目中,用的 ...
- MVC:上传文件时限制文件类型
之前写过一篇:MVC:上传文件 今天补充下一个功能:如何限制上传文件类型 文件类型可以在前段限制,但是太容易被绕过,最好还是在后端处理. 修改upload方法代码: [HttpPost] public ...
- 用C#抓取AJAX页面的内容
现在的网页有相当一部分是采用了AJAX技术,不管是采用C#中的WebClient还是HttpRequest都得不到正确的结果,因为这些脚本是在服务器发送完毕后才执行的! 但我们用IE浏览页面时是正常的 ...
- GDI+系列
1.GDI+的概述 2.绘图表面 3.GDI+坐标系 4.用Pen对象画图 1.使用GDI+画线 2.使用GDI+画弧线 3.使用GDI+画曲线 4.使用GDI+画椭圆 5.使用GDI+画矩形.多边形 ...
- CPS冥想 - 1 重新审视CPS
这篇文章是在阅读Eric Lippert大神的MSDN Blog文章时同步写成的,其中主要是各种翻译,同时还混杂自己阅读文章的笔记和感想. 原博文地址 http://blogs.msdn.com/b/ ...
- 一行代码解释.net事件与委托
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); }; delegat ...
- silverlight简单数据绑定3
3种数据绑定模式 OneTime(一次绑定) OneWay(单项绑定) TwoWay(双向绑定) OneTime:仅在数据绑定创建时使用数据源更新目标. 列子: 第一步,创建数据源对象让Person ...
- 25. Valid Palindrome
Valid Palindrome Given a string, determine if it is a palindrome, considering only alphanumeric char ...