Linux Date&clock Commands

Source: Internet
Author: User

Linux System manual Change time can be used with the date command, you can see the detailed usage method with man date

Format: Date mmddhhmm is "Day of the Month"

Format: Date mmddhhmmyyyy

Format: Date MMDDHHMM.SS

Format: Date MMDDHHMMYYYY.SS

Set the current date time, only the root user can execute, and then execute clock-w to synchronize to the hardware clock.

MM is the month, DD is the date, HH is the number of hours, MM is the number of minutes, yyyy is the year, SS is the number of seconds.

Example: Manually changing the time

[[Email protected] ~]# Date view current time Sat APR 2 20:03:23 CST 2016[[email protected] ~]# date 040220072016.40 Modify the format of the current time April 2 20:07/2016/40 sec Sat Apr 2 20:07:40 CST 2016

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/7E/6E/wKioL1b_uHqgtchzAADqkfgxC00781.jpg "title=" 1.jpg " alt= "Wkiol1b_uhqgtchzaadqkfgxc00781.jpg"/>

Linux is divided into hardware clock and system clock, hardware clock is the motherboard of the button battery to power.

Linux: Read date and time information from hardware when the system starts: After reading the information, it is no longer associated with the hardware

Date used to view the system clock

Clock is used to view hardware clocks

Clock and Hwclock are the same thing that can be seen, the clock is hwclock hard links, such as

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/7E/6E/wKioL1b_uueACkIvAAE07D5s46k702.jpg "title=" 2.jpg " alt= "Wkiol1b_uueackivaae07d5s46k702.jpg"/>

With man hwclock you get

- s,--hctosys Hardware-based, the system time to adjust the same as the hardware

Set the System time from the Hardware Clock.


- W,--SYSTOHC the system to the same system time

Set the Hardware Clock to the current System time.

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/7E/6E/wKioL1b_u-WQcebEAAMztk1KP28189.jpg "title=" 3.jpg " Width= "730" height= "165" border= "0" hspace= "0" vspace= "0" style= "width:730px;height:165px;" alt= "wkiol1b_ U-wqcebeaamztk1kp28189.jpg "/>

example, change the hardware time, whichever is the system time, as

[[email protected] ~]# clock         View current hardware time sat 02 apr 2016 08:24:02 pm cst  -0.282350  seconds[[email protected] ~]# date         View current system Time Sat apr  2 20:27:22 cst 2016[[email protected] ~]# clock  -w     system time is adjusted to be the same as the system [[email protected] ~]# clock         Verify Current hardware time sat 02 apr 2016 08:28:11 pm cst   -0.656874 seconds[[email protected] ~]# date          Verify current system time sat apr  2 20:28:14 cst 2016 

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/7E/6E/wKioL1b_vEyTxs4UAAHd_HZHQBU473.jpg "title=" 4.jpg " Width= "730" height= "185" border= "0" hspace= "0" vspace= "0" style= "width:730px;height:185px;" alt= "wkiol1b_ Veytxs4uaahd_hzhqbu473.jpg "/>

This article is from the blog "Write to Yourself", so be sure to keep this source http://zhaodongwei.blog.51cto.com/4233742/1759617

Linux Date&clock Commands

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.