shutdown

shutdown [选项] 时间

选项:

  • -c : 取消一个关机命令
  • -h : 关机
  • -r : 重启
[root@localhost ~]# date
Tue Dec 6 21:06:38 PST 2016
[root@localhost ~]# shutdown -r 07:33
Shutdown scheduled for Wed 2016-12-07 07:33:00 PST, use 'shutdown -c' to cancel.
[root@localhost ~]# shutdown -c
[root@localhost ~]#
Broadcast message from root@localhost.localdomain (Tue 2016-12-06 21:07:31 PST): The system shutdown has been cancelled at Tue 2016-12-06 21:08:31 PST! ^C
[root@localhost ~]#

使用这个命令后,会占据当前页面,可以在命令后面添加 & 来设定为不占据。

root@localhost ~]# shutdown -r 23:30 &
[1] 117992
[root@localhost ~]# Shutdown scheduled for Tue 2016-12-06 23:30:00 PST, use 'shutdown -c' to cancel. [1]+ 完成 shutdown -r 23:30 [root@localhost ~]# shutdown -c
[root@localhost ~]#
Broadcast message from root@localhost.localdomain (Tue 2016-12-06 21:12:49 PST): The system shutdown has been cancelled at Tue 2016-12-06 21:13:49 PST!

其他关机命令

  • halt
  • poweroff
  • init 0

推荐使用shutdown,因为shutdown会保存后再关机或重启,以上三个命令则不会保存。

init

对于 init,这里需要解释一下系统运行级别

  • 0 关机
  • 1 单用户
  • 2 不完全用户,不含NFS服务
  • 3 完全多用户
  • 4 未匹配
  • 5 图形界面
  • 6 重启

所以重启的话,可以用这个命令:

[root@localhost ~]# init 6

对于重启,推荐用以下命令:

reboot

该命令执行重启前,会保存数据

[root@localhost ~]# reboot

我们可以通过 runlevel 来查询系统运行级别:

runlevel

[root@localhost ~]# runlevel
N 5

这里说明我们现在运行的图形界面级别,这里我用的是CentOS7,用的是图形界面,用图形界面开启的终端,所以判断为图形界面。

退出登录命令:logout

logout

建议完成操作要关闭时,退出登录

Linux关机和重启命令的更多相关文章

  1. centos、linux关机与重启命令详解

    Linux centos关机与重启命令详解与实战 Linux centos重启命令: 1.reboot 2.shutdown -r now 立刻重启(root用户使用) 3.shutdown -r 1 ...

  2. [Linux]关机和重启命令

     Linux中常用的关机和重新启动命令有shutdown.halt.reboot以及init,它们都可以达到关机和重新启动的目的,但是每个命令的内部工作过程是不同的,下面将逐一进行介绍. 1. shu ...

  3. Linux 关机、重启 命令

    重启命令:1.reboot2.shutdown -r now 立刻重启(root用户使用)3.shutdown -r 10 过10分钟自动重启(root用户使用) 4.shutdown -r 20:3 ...

  4. Linux关机和重启命令总结

    一.shutdown 命令 作用:关闭或重启系统 使用权限:超级管理员使用 常用选项 1. -r 关机后立即重启 2. -h关机后不重启 3. -f快速关机,重启时跳过fsck(file system ...

  5. linux关机、重启命令

    1.shutdown -h 10 //计算机将在10分钟后关机,且会显示在登录用户的当前屏幕中 2.shutdown -h now //立即关机 3.shutdown -h 20:25 //系统会在2 ...

  6. Linux常用命令学习3---(文件的压缩和解压缩命令zip unzip tar、关机和重启命令shutdown reboot……)

    1.压缩和解压缩命令    常用压缩格式:.zip..gz..bz2..tar.gz..tar.bz2..rar .zip格式压缩和解压缩命令        zip 压缩文件名 源文件:压缩文件   ...

  7. Linux的关机与重启命令

    Linux的关机与重启命令 作者: Aillo, 发布于2009-05-10, 在系统分类下, 1条留言. 重启命令:1.reboot2.shutdown -r now 立刻重启(root用户使用)3 ...

  8. Linux 学习 (六) 关机与重启命令

    Linux达人养成计划 I 学习笔记 shutdown [选项] 时间 -c:取消前一个关机命令 -h:关机 -r:重启 shutdown命令会在关机或重启时自动保存系统中正在运行的服务,最安全的关机 ...

  9. linux虚拟机关机、重启命令

    linux虚拟机关机.重启命令   一.shutdown 1.shutdown -h now :立即关机 2.shutdown -h 10:53:到10:53关机 3.shutdown -h +10 ...

随机推荐

  1. NSUserDefaults存取失败

    解决办法: 1.存储NSUserDefaults时,强制NSUserDefault存入沙盒 [[NSUserDefaults standardUserDefaults] setObject:sAcco ...

  2. could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'

    VS2008, 写一个简单的demo的时候出现了这个: 1>------ Build started: Project: GetExportTable, Configuration: Relea ...

  3. Leetcode: Valid Word Abbreviation

    Given a non-empty string s and an abbreviation abbr, return whether the string matches with the give ...

  4. windows下的host文件在哪里?做什么用的?

    在Window系统中有个Hosts文件(没有后缀名),在Windows98系统下该文件在Windows目录,在Windows2000/XP系统中位于C:\Winnt\System32\Drivers\ ...

  5. (一)NOR FALSH 讲解

    nor flash 起始地址: 1F FFFF  = 1 1111          1111 1111 1111 1111 = 2^20 *2 = 2^21=2M Nor Flash 采用了 A0- ...

  6. ListView遍历每个Item出现NullPointerException的异常

    在使用ListView过程中我们有时候需要遍历取得每个Item项中的一些数据(比如每个Item里面有TextView,需要获取它的文本等等),但是我们在遍历过程中经常会遇到NullPointerExc ...

  7. hdu 1004 Let the Balloon Rise

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  8. Java多线程开发系列之三:线程这一辈子(线程的生命周期)

    前文中已经提到了,关于多线程的基础知识和多线程的创建.但是如果想要很好的管理多线程,一定要对线程的生命周期有一个整体概念.本节即对线程的一生进行介绍,让大家对线程的各个时段的状态有一定了解. 线程的一 ...

  9. 夺命雷公狗-----React---15--三元运算符

    <!DOCTYPE> <html> <head> <meta charset="utf-8"> <title></ ...

  10. python 在最后一行追加

    2.文本文件的写入 import fileinput file = open("D:\\test.txt", encoding="utf-8",mode=&qu ...