One day a Linux basic command shutdown command shutdown

Source: Internet
Author: User

Power off restart command shutdown

1 , command format

Shutdown[options] [+]time

2 , command functions

shutdown commands can be safely shut down or restarted Linux Systems , it prompts a warning message to all logged-in users on the system before the system shuts down, the system notifies all users 5 minutes before the specified time is shut down, and the system shuts down immediately, and within 5 minutes, the newly logged-on user is forbidden to log in.

The command also allows the user to specify a time parameter, which can be either an exact time or a time period from now on.

Time Format:

Now : Now

              +# : The number of minutes after the shutdown

hh:mm : The specified time is shut down, the specified - -hour format

3 , command parameters

- R : System Restart

- H : System shutdown

- P : Power off after shutting down the system

- k : Analog shutdown (not true shutdown), just send a warning message to the login to go out!  

4 , Common instances

1 , Close now Linux system

command: Shutdown-h Now

[Email protected]~]# shutdown-h now broadcastmessage from [email protected] (/dev/pts/0) at 12:25 ... Thesystem is going down for halt now!


2 , the system in 5 minutes after restart

command: shutdown-r +5

[Email protected]~]# shutdown-r +5 broadcastmessage from [e-mail protected] (/dev/pts/0) at 12:26 ... Thesystem is going-reboot in 5 minutes! [[Email protected]~]# shutdown-r +5&//& Send command to Background run [1] 1527[[email protected]~]# broadcastmessage from [email Protected] (/dev/pts/0) at 12:26 ... Thesystem is going-reboot in 5 minutes! [[Email protected]~]#


3 , set the time at which the system shuts down or restarts.

command: shutdown-h | shutdown-r 21:30

[Email protected]~]# datesat Dec24 12:30:09 CST 2016[[email protected]~]# shutdown-r-broadcastmessage from [email Protected] (/dev/pts/0) at 12:30 ... Thesystem is going down for reboot in 1410 Minutes!^cshutdown:shutdown cancelled[[email protected]~]# shutdown-r 12:00&am P [1] 1544[[email protected]~]# broadcastmessage from [e-mail protected] (/dev/pts/0) at 12:30 ... Thesystem is going-reboot in 1410 minutes! [[Email protected]~]#


It 's best to use commands & The shutdown command is handled in the background. Does not affect the current other operations.

Tips:

set how long the time after executionshutdowncommand. Time parameters arehh:mmor+mtwo different modes. hh:mmthe format represents a few minutes of executionshutdowncommand. For example"Shutdown"indicates that it will be in12:00pmExecutionshutdown. +mrepresentsmminutes after executionshutdown.A more specific usage is to Nowindicates immediate executionshutdown.It is worth noting that this part of the argument cannot be omitted. Also, be aware that if you have now22:30, you have executedshutdown-h 22:00 &then the second genius will turn off the machine.

4 , cancel shutdown or restart command

command: shutdown-c

[[Email protected]~]# shutdown:shutdown cancelled [1]+ done shutdown-r 12:00[[email protected]~]#


Tips:

If the command is not running in the background, you can use Ctrl + C to cancel the command

5 , the shutdown command can also send a shutdown message to the logged-on user before shutting down the computer

command: shutdown-h +5 " Systemshutdown after five minutes "&

[Email protected]~]# broadcastmessage from [e-mail protected] (/dev/pts/0) at 12:38 ... Thesystem is going-halt in 5 minutes! System shutdown after five minutes [[email protected]~]#


Halt : The shutdown command, which is called shutdown-h

Halt [Options] ...

Command parameters

- F : Force shutdown, do not call shutdown (8) Tube shut down machine

- W : Test only, do not really turn the system back on, will only write the data of the re-boot /var/log under the directory wtmp Record File

- P : While shutting down the power-down operation, call Poweroff Command

Common examples

Halt : Shut down the machine

Poweroff : Power off Command

Turn off the power when you're done shutting down the machine.

reboot : Restart command, call is Shutdown-r


This article is from "Linux rookie" blog, please be sure to keep this source http://geekb0y.blog.51cto.com/10743719/1885728

One day a Linux basic command shutdown command shutdown

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.