Linux常用命令(一)
一、shutdown
Shutdown
使用权限:系统管理员
用法:shutdown [选项] 时间 [警告信息]
作用:关机
例子:shutdown -h now 立即关机
Shutdown -h 17:37 17:37时关机
参数:
-r 重启
-h 关闭电源(关机)
-H 关闭电源(同-h)
-P 关闭电源(同-h)
-c 中断关机
-k 仅仅发送警告信息,不关机
-q,–quiet 减少错误信息
-v,–verbose 增加输出,包含信息
Shutdown帮助文档
Usage: shutdown [OPTION]… TIME [MESSAGE] Bring the system down.
Options: -r reboot after shutdown -h
halt or power off after shutdown -H halt
after shutdown (implies -h) -P power off
after shutdown (implies -h) -c cancel a
running shutdown -k only send warnings,
don’t shutdown -q, –quiet reduce output to errors
only -v, –verbose increase output to include
informational messages
–help display this help and exit
–version output version information and exitTIME may have different formats, the most common is simply the word
‘now’ which will bring the system down immediately. Other valid
formats are +m, where m is the number of minutes to wait until
shutting down and hh:mm which specifies the time on the 24hr clock.Logged in users are warned by a message sent to their terminal, you
may include an optional MESSAGE included with this. Messages can be
sent without actually bringing the system down by using the -k option.If TIME is given, the command will remain in the foreground until the
shutdown occurs. It can be cancelled by Control-C, or by another user
using the -c option.The system is brought down into maintenance (single-user) mode by
default, you can change this with either the -r or -h option which
specify a reboot or system halt respectively. The -h option can be
further modified with -H or -P to specify whether to halt the system,
or to power it off afterwards. The default is left up to the shutdown
scripts.Report bugs to upstart-devel@lists.ubuntu.com
二、halt
Halt
使用权限:系统管理员
用法:halt [选项]
作用:关机
例子:halt -n 关机或重启前资料不做同步处理
halt 关闭系统
参数:
-n 关机或重启前资料不做同步处理
-f 强制关机
-p 关闭电源
-w 并不关机,把记录写到 /var/log/wtmp 档案里
-q 减少错误信息
-v 增加输出,包含信息
Halt帮助文档
Usage: halt [OPTION]… Halt the system. Options: -n, –no-sync
don’t sync before reboot or halt -f, –force force
reboot or halt, don’t call shutdown(8) -p, –poweroff
switch off the power when called as halt -w, –wtmp-only
don’t actually reboot or halt, just write wtmp
record -q, –quiet reduce output to errors only -v, –verbose increase
output to include informational messages
–help display this help and exit
–version output version information and exit This command is intended to instruct the kernel to reboot or halt the
system; when run without the -f option, or when in a system runlevel
other than 0 or 6, it will actually execute /sbin/shutdown. Report
bugs to upstart-devel@lists.ubuntu.com
三、reboot
使用权限:系统管理员
用法:reboot [选项]
作用:重启系统
例子:reboot
重启 参数同halt
Reboot帮助文档
Usage: reboot [OPTION]… Reboot the system.
Options: -n, –no-sync don’t sync before reboot or
halt -f, –force force reboot or halt, don’t call
shutdown(8) -p, –poweroff switch off the power when
called as halt -w, –wtmp-only don’t actually reboot or
halt, just write wtmp
record -q, –quiet reduce output to errors only -v, –verbose increase
output to include informational messages
–help display this help and exit
–version output version information and exitThis command is intended to instruct the kernel to reboot or halt the
system; when run without the -f option, or when in a system runlevel
other than 0 or 6, it will actually execute /sbin/shutdown.Report bugs to upstart-devel@lists.ubuntu.com
四、logout
在shell界面直接使用;进入shell界面为ctrl+alt+F1~F6
五、init
使用权限:系统管理员
用法:init [选项]
作用:系统第一进程
参数:
-q 减少错误信息 -v 增加输出,包含信息 #0 停机(千万不能把initdefault 设置为0)
#1 单用户模式
#2 多用户,没有 NFS(和级别3相似,会停止部分服务) #3 完全多用户模式 #4 没有用到
#5 x11(Xwindow)
#6 重新启动(千万不要把initdefault 设置为6)
Init帮助文档:
Usage: init [OPTION]… Process management daemon.
Options:
–confdir=DIR specify alternative directory to load
configuration files from
–default-console=VALUE
default value for console stanza
–no-dbus do not connect to a D-Bus bus
–no-inherit-env jobs will not inherit environment of init
–logdir=DIR specify alternative directory to store job output
logs in
–no-log disable job logging
–chroot-sessions enable chroot sessions
–no-startup-event do not emit any startup event (for testing)
–restart flag a re-exec has occurred
–state-fd=FD specify file descriptor to read serialisation
data from
–session use D-Bus session bus rather than system bus (for
testing)
–startup-event=NAME specify an alternative initial event (for
testing)
–user start in user mode (as used for user sessions)
–write-state-file attempt to write state file on every re-exec -q, –quiet reduce output to errors only
-v, –verbose increase output to include informational messages
–help display this help and exit
–version output version information and exitThis daemon is normally executed by the kernel and given process id 1
to denote its special status. When executed by a user process, it
will actually run /sbin/telinit.Report bugs to upstart-devel@lists.ubuntu.com