How to modify the linux system Time (date command)

Source: Internet
Author: User
The date command can not only display the current time of the system, but also use it to modify the system time. The following is a brief introduction to facilitate the users who need it.

Command format:

Date-s time string

For example, you can modify only the system date without changing the time (hours, minutes, and seconds)

Date-s 2012-08-02

Or modify only the time without modifying the date

Date-s 10:08:00

Of course, you can also modify the date and time at the same time.

Date-s "04:53:00"

Note: Because there is a space between the date and time, it must be enclosed by quotation marks. Otherwise, an error is returned.

The above modification only modifies the linux system time, and the time in CMOS may not change. Therefore, we need to use clock-w to write the current system time to CMOS for insurance purposes.

The relationship between system time and CMOS time. The system time is maintained by the linux operating system, and the CMOS time is the time when the CMOS chip is saved. When the system starts, the operating system records the read time from CMOS as the system time, and the operating system automatically writes the system time to CMOS at intervals of time. If you use the date command to change the system time and restart the computer immediately, the operating system has not synchronized the system time to CMOS, so there is still no pre-modification time after the boot, so for the sake of security, you can also manually use the clock command to synchronize the system time to CMOS.

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.