One Linux command per day (shutdown) command

Source: Internet
Author: User

Shutdown shuts down the system in a safe way.

(1) Usage:

usage: shutdown [parameter] [TIME]

(2) Function:

function: system shutdown command, shutdown instruction can close all programs, and according to the needs of users, to restart or shutdown action, all users can see the shutdown information prompt.

principle: shutdown is implemented by notifying the INIT process that it is required to change the runlevel. Run level 0 is used to shut down the system, run Level 6 is used to restart the system, run Level 1 is used to get the system to perform the System Management task State, if not given the-H or-R flag, this is the default working state of the shutdown command.

(3) Option parameters:

1)-H turn the system off

2)-R shutdown after reboot

3)-K simply sends out information to all users, but does not actually shut down

4)-F Skip disk detection when rebooting

5)-F Force disk detection on restart.

6)-C cancels the running shutdown process. It is not possible to specify the time parameter for this option, but you can enter an explanatory message at the command line to explain to all users.

(The general shutdown instruction can be interrupted by pressing the "+" sign)

(4) Example:

1) Perform a shutdown command at a specific time:

Shutdown-h now         // shut down immediately :xx      // shut down at 12:00

2) Specify the shutdown after 5 minutes and send a warning message to the logged in user

[Email protected]:/home/sunjimeng# shutdown +5"this System would beshutdown in 5 minute! " broadcast Information    from [email protected] (/dev/pts/6:in5 Minutes!   System Reminder  in5 minute! User-definable reminders

3) Cancel Shutdown command

Shutdown-c

4) Perform the shutdown Restart command at a specific time and cancel

[[Email protected] ~]$ su root//must be the root user password: [[email protected] sunmeng]# shutdown-R +3 "shutdown restart after 3 minutes"Shutdown Scheduled forThree .- .- in  +: -: -PDT, use'shutdown-c'To Cancel. [Email protected] sunmeng]# broadcast message from[Email protected] (Wed .- .- in  +: -: -PDT): Shutdown after 3 minutes Restart the system isGoing down forReboot at Wed .- .- in  +: -: -Pdt![email protected] sunmeng]# shutdown-Cbroadcast Message from[Email protected] (Wed .- .- in  +: -: -PDT): The system shutdown have been cancelled at Wed .- .- in  +: $: -Pdt!

5) Shutdown-k does not really shut down, just send reminders to each logged-in user

[Email protected] sunmeng]# shutdown-k"Warning:maybe The system would be shutdown."Failed to parse time Specification:Warning:Maybe the system would be shutdown. [Email protected] sunmeng]# shutdown-K5 "Warning:maybe The system would be shutdown."Shutdown Scheduled forThree .- .- in  +: -: AboutPDT, use'shutdown-c'To Cancel. [Email protected] sunmeng]# broadcast message from[Email protected] (Wed .- .- in  +: -: AboutPDT): Warning:maybe The system would be shutdown. The System isGoing down forPower-off at Wed .- .- in  +: -: AboutPdt!

6) Fast or slow restart (Unbuntu with-F or-f parameters, CentOS not)

Shutdown-f  [TIME]         // Fast restart, ignoring disk check shutdown-f  [TIME]         //  Force disk Check

(5) Other:

1) Permanently change the system time:

// The Date command can only temporarily change the system time, the time after the shutdown restart, and the time required to write to the BIOS " 2016-06-30 11:05:10 "  All:$-W

2) display the processor architecture of the machine:

[Email protected] sunmeng]# archx86_64

3) Other shutdown commands:

0             // turn off the machine 6            // Power off Restart     Reboot            // power off restart

4) Clock and date command:

//only super users can set the hardware clock. [[Email protected] ~]$ su root password: [[email protected] sunmeng]# clock--Set--date="05/04/2013 14:30:01"//Set hardware time to 2013 years[[email protected] sunmeng]# clock2013 May 04 Saturday 14:30 12 seconds-0.388214seconds [[email protected] sunmeng]# Date//Hardware time is 2013, system time is 20,162,016 year June 29 Wednesday -: -: $pdt[[email protected] sunmeng]# clock-S//Set system time according to hardware time [[email protected] sunmeng]# date2013 Saturday May 04 -: to:GenevaPdt[[email protected] sunmeng]# clock2013 May 04 Saturday 14:31 09 Seconds-0.101952seconds//system time and hardware time are 2013 years[[email protected] sunmeng]# date-S"2016-06-30 11:22:10"//Set the system time to 2016 yearsThursday, June 30, 2016 One: A:Tenpdt[[email protected] sunmeng]# clock//System time is 2016, hardware time is 20,132,013 years May 04 Saturday 14:32 13 seconds -0.559223seconds [[email protected] sunmeng]# clock-w//Set hardware time according to system time [[email protected] sunmeng]# date2016 Thursday June 30 One: A:WuyiPdt[[email protected] sunmeng]# clock2016 June 30 Thursday 11:22 56 seconds-0.968643Seconds

5) Display the information of the native shell, or you can change the shell

[[email protected] ~]$ Chsh-l/bin/sh/bin/bash/sbin/nologin/usr/bin/sh /usr/bin/bash/usr/sbin/nologin/bin/tcsh/bin/~]$ chsh-vchsh, from Util  2.23. 2

The last article of a Linux command every day, and the rest of the knowledge about Linux systems will be covered later.

One Linux command per day (shutdown) command

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.