Time modification under Linux

Source: Internet
Author: User

The Linux system has two time, one is the system time, the other is the CMOS time.

Need to put two time to tune!

Method One: Modify the system time

(1). Log in as root and adjust the system time with the date command

Date-s "2017/11/10 10:20:00" Change the system time to November 10, 17 10:20

This modification fails after the system restarts, so in order to make this time permanent, the modified time needs to be written to the CMOS.

(2) then perform hwclock-w to synchronize the system time to CMOS time

Time to look at CMOS:

#hwclock/clock–r

Writes the current system time to the CMOS

#hwclock/clock–w

Method Two: Modify hardware time

(1). Log in as root and tune CMOS time with hwclock/clock--set--date command

Hwclock/clock--set--date== "10:20:00 2017-11-10" to change CMOS time to November 10, 2017 10:20 0 seconds)

(2) then perform hwclock-s to synchronize CMOS time to system time

0 0 * * hwclock-s can be added under the root user's crontab-e

Keep syncing every day

Common formatting:

A, Hwclock/clock--set--date= "month/day/year: minutes: Seconds"

#hwclock/clock--set--date= "09/17/2003 09:54:00"

b, or hwclock--set--date hh:mm:ss command

Hwclock/clock--set--date 09:54:00

Hwclock: Hardware Clock

-W: Synchronizing system time to hardware time

-S: Synchronizing hardware time to System time

In Linux system, CMOS time is more accurate, but system time error is large (especially virtual machine).

Date-r/etc/passwd//View the last modified time of the file

This article is from "Operation and maintenance record Mei Ling" blog, please be sure to keep this source http://meiling.blog.51cto.com/6220221/1980557

Time modification under Linux

Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

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.