`
wangleide414
  • 浏览: 591161 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

Linux关机命令详解

 
阅读更多

关机命令有三个halt,shutdown,poweroff,以及重启命令reboot
halt确有其命令,以及man内容。
shutdown也是专门负责关机的命令,并是独立的程序。
poweroff命令并不存在,但他直接调用的是halt -p的默认命令参数,是link过来的,下面我也提到了
reboot是重启命令,作用内容可以参考halt的man
......
[root@acnis root]# halt --help
usage: halt [-n] [-w] [-d] [-f] [-i] [-p]
-n: don't sync before halting the system
-w: only write a wtmp reboot record and exit.
-d: don't write a wtmp record.
-f: force halt/reboot, don't call shutdown.
-p: power down the system (if possible, otherwise halt)
参数说明:
   [-n] 防止 sync 系统调用,它用在用fsck修补根分区之后,以阻止内核用老版本的超级块(superblock)覆盖修补过的超级块。
   [-w] 并不是真正的重启或关机,只是写 wtmp(/var/log/wtmp)纪录。
   [-d] 不写 wtmp 纪录(已包含在选项 [-n] 中)。
   [-f] 没有调用 shutdown 而强制关机或"重启"(指的是reboot)。
   [-i] 关机(或重启)前,关掉所有的网络接口。
   [-p] 该选项为缺省选项。就是关机时调用 poweroff。 (isher喜欢直接用poweroff命令)
   [-h] 在系统关闭之前,从系统中正确的移除所有的磁盘驱动器。
说明poweroff命令很多人不知道,这也是在/sbin下面的命令,是一个link,连接到halt -p的命令上。

[root@acnis sbin]# ll |grep pow
lrwxrwxrwx 1 root root 4 2002-01-13 poweroff -> halt

为了说明,MAN一下poweroff
MAN poweroff(halt) 得到以下内容,可以作为对照,对于halt -h
同时包含了halt命令和reboot的解释,因为poweroff本就是halt的快捷方式而已(windows的话)
NAME
halt, reboot, poweroff - stop the system.
SYNOPSIS
/sbin/halt [-n] [-w] [-d] [-f] [-i] [-p] [-h]
/sbin/reboot [-n] [-w] [-d] [-f] [-i]
/sbin/poweroff [-n] [-w] [-d] [-f] [-i] [-h]
OPTIONS
-n Don't sync before reboot or halt.
-w Don't actually reboot or halt but only write the wtmp record (in
the /var/log/wtmp file).
-d Don't write the wtmp record. The -n flag implies -d.
-f Force halt or reboot, don't call shutdown(8).
-i Shut down all network interfaces just before halt or reboot.
-h Put all harddrives on the system in standby mode just before
halt or poweroff.
-p When halting the system, do a poweroff. This is the default when
halt is called as poweroff.

[root@acnis root]# shutdown --help
shutdown: invalid option -- -
Usage: shutdown [-akrhfnc] [-t secs] time [warning message]
-a: use /etc/shutdown.allow
-k: don't really shutdown, only warn.
-r: reboot after shutdown.
-h: halt after shutdown.
-f: do a 'fast' reboot (skip fsck).
-F: Force fsck on reboot.
-n: do not go through "init" but go down real fast.
-c: cancel a running shutdown.
-t secs: delay between warning and kill signal.
** the "time" argument is mandatory! (try "now") **
参数说明
shutdown 命令可以安全地关闭或重启Linux系统,它在系统关闭之前给系统上的所有登录用户提示一条警告信息。该命令还允许用户指定一个时间参数,可以是一个精确的时间,也可以是从现在开始的一个时间段。精确时间的格式是hh:mm,表示小时和分钟;时间段由“ ”和分钟数表示。系统执行该命令后,会自动进行数据同步的工作。
该命令的一般格式为: shutdown [选项] [时间] [警告信息] 命令中各选项的含义为:
   [-t] seconds : 设定在几秒钟之后进行关机程序
   [-k] 并不真正关机,而只是发出警告信息给所有用户。
   [-r] 关机后立即重新启动。
   [-h] 关机后不重新启动。
   [-f] 快速关机,重启动时跳过fsck。
   [-F] : 关机时,强迫进行 fsck 动作
   [-n] 快速关机,不经过init程序。
   [-c] 取消一个已经运行的shutdown。
×需要特别说明的是,该命令只能由超级用户使用。
time : 设定关机的时间
message : 传送给所有使用者的警告讯息
MAN shutdown 得到以下内容,可以作为对照
NAME
shutdown - bring the system down
SYNOPSIS
/sbin/shutdown [-t sec] [-arkhncfF] time [warning-message]
OPTIONS
-a Use /etc/shutdown.allow.
-t sec Tell init(8) to wait sec seconds between sending processes the
warning and the kill signal, before changing to another run-
level.
-k Don't really shutdown; only send the warning messages to every-
body.
-r Reboot after shutdown.
-h Halt after shutdown.
-n [DEPRECATED] Don't call init(8) to do the shutdown but do it
ourself. The use of this option is discouraged, and its results
are not always what you'd expect.
-f Skip fsck on reboot.
-F Force fsck on reboot.
-c Cancel an already running shutdown. With this option it is of
course not possible to give the time argument, but you can enter
a explanatory message on the command line that will be sent to
all users.

分享到:
评论

相关推荐

    Linux系统关机命令详解.pdf

    Linux系统关机命令详解.pdf

    Linux关机和重启服务器命令详解

    Linux关机和重启服务器命令详解

    Linux关机命令

    redhat 关机注销命令详解

    详解linux 关机命令总结

    本篇文章主要介绍了linux 关机命令总结,linux下常用的关机命令有:shutdown、halt、poweroff、init,有兴趣的可以了解一下。

    linux shutdown命令详解

    shutdown命令用来系统关机命令。shutdown指令可以关闭所有程序,并依用户的需要,进行重新开机或关机的动作。 语法 shutdown(选项)(参数) 选项 -c:当执行“shutdown -h 11:50”指令时,只要按+键就可以中断关机...

    Linux操作(命令详细解析)

    在Linux系统中RPM 命令参数使用详解.doc 送给初学的穷人:Linux系统指令大全.doc 使用Linux操作系统命令来发送信息.doc 扫盲行动之一:Linux常用...关于 Linux系统中关机命令详细解析.doc Linux必学的系统管理命令.doc

    第四课:创建目录之MD命令的详解.exe

    第17课:系统设置与管理之自动关机命令详解 第18课:系统设置与管理之任务管理命令详解 第19课:telnet命令的使用演示 第20课:系统设置与管理之时间和日期的更改命令详解数据报 第21课:DOS命令跟踪诊断数据报 第22...

    大数据基础-Linux基础详解课程35.基本命令-系统关机重启.mp4

    大数据基础-Linux基础详解课程

    Linux命令大全搜索工具,内容包含Linux命令手册、详解、学习、搜集 .rar

    1、开关机命令 shutdown -h now:现在关机 shutdown -r now:现在重启 reboot:现在重启计算机 su [用户名]:切换用户,不加用户名的话默认切换到root用户 password :修改密码 # 未成功 logout:用户注销 2、常用...

    详解Linux系统中关机与重启相关命令的用法

    这篇文章主要介绍了Linux系统中关机与重启相关命令的使用,包括关机时会用到的shutdown和halt命令以及重启的reboot命令,需要的朋友可以参考下。

    Linux命令学习总结:详解reboot命令

    该命令用来重启Linux系统。相当于Windows系统中的restart命令。 命令语法: /sbin/reboot [-n] [-w] [-d] [-f] [-i] 或 reboot [-n] [-w] [-d] [-f] [-i] 命令参数: 参数 长参数 描叙 -d 重新...

    详解 Linux中的关机和重启命令

    -c:取消前一次关机命令 -h:关机 -r:重启 二 shutdown实战 [root@localhost tmp]# date Sat Jul 15 09:28:35 CST 2017 [root@localhost tmp]# shutdown -r 05:30 Shutdown scheduled for Sun 2017-07-16 05:30:...

    Linux shutdown命令用法详解

    Linux shutdown命令可以用来进行关机程序,并且在关机以前传送讯息给所有使用者正在执行的程序,shutdown 也可以用来重开机。 使用权限:系统管理者。 语法shutdown [-t seconds] [-rkhncfF] time [message] 参数...

    Linux halt命令用法详解

    Linux halt命令 若系统的 runlevel 为 0 或 6 ,则Linux halt命令关闭系统,否则以 shutdown 指令(加上 -h 参数)来取代。 使用权限:系统管理者。 语法halt [-n] [-w] [-d] [-f] [-i] [-p] 参数说明: -n : 在关机...

Global site tag (gtag.js) - Google Analytics