Linux Command Learning-date

Source: Internet
Author: User

The date command can be used to display and modify the system datetime, noting that it is not a time command.

1. Enter date at the command line to display the current time

[[Email protected] logs]# Date
Sat Nov 00:00:02 CST 2014

2. Enter the date-s date on the command line

Only modified date, not modified time

[Email protected] logs]# date-s 2014-11-21
Fri 00:00:00 CST 2014

3. Enter date-s time at the command line

Modify time only, no date modified

[Email protected] logs]# date-s 14:15:00
Fri 14:15:00 CST 2014

4, in the command line input date-s also modify the date time, note to add double quotation marks, the date and time there is a space

[[email protected] logs] #date-S "2007-08-03 14:15:00"

Note that this is the system time that is maintained by the Linux operating system. when the system starts, theLinux operating system reads the time from the CMOS into the system time variable, and the later modification time is realized by modifying the system time. To keep the system time consistent with the CMOS time,Linux writes the system time to CMOS at every time. Since this synchronization takes place at intervals (about 11 minutes), if the machine is re-started immediately after we execute the DATE-S, the modification time may not be written to the CMOS, which is the cause of the problem.    You can execute the following command if you want to make sure that the changes take effect. [[email protected] logs]#clock-w This command forces the system time to be written to the CMOS     。 

Linux Command Learning-date

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.