Linux命令学习总结:reboot命令

命令简介:

 

该命令用来重启Linux系统。相当于Windows系统中的restart命令。

 

命令语法:

/sbin/reboot [-n] [-w] [-d] [-f] [-i]

reboot [-n] [-w] [-d] [-f] [-i]

 

命令参数:


参数


长参数


描叙


-d


重新启动时不把数据写入记录文件/var/tmp/wtmp


-f


强制重新开机,不调用shutdown指令的功能。


-h


在系统关机或poweroff之前,将所有的硬盘处于待机模式


-i


关闭网络设置之后再重新启动系统


-n


保存数据后再重新启动系统


-p


When halting the system, do a poweroff. This is the default when halt is called as poweroff


-w


仅做测试,并不真的将系统重新开机,只会把重开机的数据写入/var/log目录下的wtmp记录文件


--help


显示命令在线帮助

 

使用示例:

 

1: 查看reboot命令的帮助信息

[root@DB-Server ~]# reboot --help
usage: reboot [-n] [-w] [-d] [-f] [-h] [-i]
        -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.
        -h: put harddisks in standby mode.
        -i: shut down all network interfaces.

[root@DB-Server ~]# man reboot

[root@DB-Server ~]# man reboot
HALT(8)               Linux System Administrator鈥檚 Manual              HALT(8)
 
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]
 
DESCRIPTION
       Halt notes that the system is being brought down in the file /var/log/wtmp, and then either tells the kernel to halt, reboot or poweroff the system.
 
       If  halt  or reboot is called when the system is not in runlevel 0 or 6, in other words when it鈥檚 running normally, shutdown will be invoked instead (with
       the -h or -r flag). For more info see the shutdown(8) manpage.
 
       The rest of this manpage describes the behaviour in runlevels 0 and 6, that is when the systems shutdown scripts are being run.
 
OPTIONS
       -n     Don鈥檛 sync before reboot or halt. Note that the kernel and storage drivers may still sync.
 
       -w     Don鈥檛 actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).
 
       -d     Don鈥檛 write the wtmp record. The -n flag implies -d.
 
       -f     Force halt or reboot, don鈥檛 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.
 
DIAGNOSTICS
       If you鈥檙e not the superuser, you will get the message 鈥榤ust be superuser鈥?  Users logged in locally on the console can call  halt,  reboot,  and  poweroff
       without supplying the root password, due to pam_console (8).
 
NOTES
       Under  older sysvinit releases , reboot and halt should never be called directly. From release 2.74 on halt and reboot invoke shutdown(8) if the system is
       not in runlevel 0 or 6. This means that if halt or reboot cannot find out the current runlevel (for example, when /var/run/utmp  hasn鈥檛  been  initialized
       correctly) shutdown will be called, which might not be what you want.  Use the -f flag if you want to do a hard halt or reboot.
 
       The  -h  flag puts all harddisks in standby mode just before halt or poweroff. Right now this is only implemented for IDE drives. A side effect of putting
       the drive in standby mode is that the write cache on the disk is flushed. This is important for IDE drives, since the kernel doesn鈥檛 flush the write-cache
       itself before poweroff.
 
       The  halt  program  uses  /proc/ide/hd* to find all IDE disk devices, which means that /proc needs to be mounted when halt or poweroff is called or the -h
       switch will do nothing.
 
AUTHOR
       Miquel van Smoorenburg, miquels@cistron.nl
 
SEE ALSO
       shutdown(8), init(8), pam_console(8)
 
                                  Nov 6, 2001                          HALT(8)
(END) 

 

 2:强制重新开机,不调用shutdown指令的功能

 

[root@DB-Server ~]# reboot -f

 

3:关闭网络设置之后再重新启动系统

[root@DB-Server ~]# reboot -i
 
Broadcast message from root (pts/1) (Mon Jul 28 11:31:28 2014):
 
The system is going down for reboot NOW!
 

 

4:保存数据后再重新启动系统

[root@DB-Server ~]# reboot -n
 
Broadcast message from root (pts/1) (Mon Jul 28 11:33:57 2014):
 
The system is going down for reboot NOW!
 

 

5:重新启动时不把数据写入记录文件/var/tmp/wtmp

[root@DB-Server ~]# reboot -d
 
Broadcast message from root (pts/2) (Mon Jul 28 11:23:26 2014):
 
The system is going down for reboot NOW!
时间: 2024-12-29 16:35:54

Linux命令学习总结:reboot命令的相关文章

Linux命令学习总结: file命令

命令简介: 该命令用来识别文件类型,也可用来辨别一些文件的编码格式.它是通过查看文件的头部信息来获取文件类型,而不是像Windows通过扩展名来确定文件类型的. 执行权限 :All User 指令所在路径:/usr/bin/file 命令语法: file [ -bchikLnNprsvz ] [ -f namefile ] [ -F separator ] [ -m magicfiles ] file ... 命令参数: 下表列出了部分常用的参数. 参数 长参数 描叙 -b 列出文件辨识结果时,

c/c++unix/linux基础学习笔记-常用命令和vi的使用

linux 基本命令的使用-命令在ubuntu下面执行,有些命令通用其他linux,有些不通用. 多条命令间用;号隔开,回车后可以一起执行. clear-前屏,pwd显示当前目录,cd跳转目录. sudo [命令]  -ubuntu 下以管理员身份运行命令. 一般情况下,运行当前目录下的程序,要用 ./文件名 执行. 查看当前shell名称:ps 进入另外一个shell,直接输入shell名称:ksh/tcsh/sh/bash,退出一个shell用:exit. 切换shell命令,如:exec

Linux 命令学习之dpkg命令详解

dpkg是一个Debian的一个命令行工具,它可以用来安装.删除.构建和管理Debian的软件包. 下面是它的一些命令解释: 1)安装软件 命令行:dpkg -i <.deb file name> 示例:dpkg -i avg71flm_r28-1_i386.deb 2)安装一个目录下面所有的软件包 命令行:dpkg -R 示例:dpkg -R /usr/local/src 3)释放软件包,但是不进行配置 命令行:dpkg –unpack package_file 如果和-R一起使用,参数可以

【AIX 命令学习】mkvg 命令

用途 创建卷组. 语法 mkvg [ -B ] [ -t factor ] [ -S [ -v LogicalVolumes ] [ -P Partitions ] ] [ -C ] [ -G ] [ -f ] [ -i ] [ -I ][ -c] [ -x ] [ -L LTGSize ] [ -n ] [ -s Size ] [ -V MajorNumber ] [ -y VolumeGroup ] PhysicalVolume ... 描述 mkvg 命令使用 PhysicalVolume

【AIX 命令学习】migratepv 命令

用途 将已分配的物理分区从一个物理卷移动到另一个或多个其他物理卷. 语法migratepv [  -i ] [  -l LogicalVolume ] SourcePhysicalVolume DestinationPhysicalVolume... 描述   migratepv 命令将已分配的物理分区和它们包含的数据从 SourcePhysicalVolume 移到一个或多个其他物理分区.要限制传送到特定的物理卷,请在 DestinationPhysicalVolume 参数中使用一个或多个物

【AIX 命令学习】lsvg 命令参数使用!

ufserver[/]#lsvg rootvg  ----查看rootvg卷组的详细信息及状态 VOLUME GROUP:       rootvg                   VG IDENTIFIER:  00cecd3e00004c000000011e4872bbdd VG STATE:           active                   PP SIZE:        128 megabyte(s) VG PERMISSION:      read/write 

【AIX 命令学习】errpt 命令参数使用!

el_sequence 错误记录戳记编号 el_label 错误标签 el_timestamp 错误日志记录的时间戳记 el_crcid 唯一的循环冗余检验(CRC)的错误标识符 el_machineid 机器标识变量 el_nodeid 节点标识变量 el_class 错误类 el_type 错误类型 el_resource 资源名称 el_rclass 资源类 el_rtype 资源类型 el_vpd_ibm IBM 重要产品数据(VPD) el_vpd_user 用户 VPD el_in

【AIX 命令学习】errpt 命令示例!

要想显示一个完整的摘要报告,请输入: errpt 要想显示一个完整的详细报告,请输入: errpt  -a 要想显示一个错误标识符 E19E094F 记录的所有的错误的报表,请输入: errpt  -a  -j E19E094F 要想显示一个在过去 24 小时内记录下来的所有错误的详细报表,请输入: errpt  -a  -s mmddhhmmyy 这里,mmddhhmmyy 字符串等于当前的月.日.小时.分和年再减去 24 小时. 要想列出为其日志为任何错误日志记录关闭的错误记录模板,请输入:

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

命令简介:  该命令用来重启Linux系统.相当于Windows系统中的restart命令. 命令语法: /sbin/reboot [-n] [-w] [-d] [-f] [-i] 或 reboot [-n] [-w] [-d] [-f] [-i] 命令参数: 参数 长参数 描叙 -d 重新启动时不把数据写入记录文件/var/tmp/wtmp -f 强制重新开机,不调用shutdown指令的功能. -h 在系统关机或poweroff之前,将所有的硬盘处于待机模式 -i 关闭网络设置之后再重新启动