Several methods linux time zone changes

  

CentOS:

1, first set about the system's time zone, use the following command

#cp /usr /share /zoneinfo /Asia /Shanghai /etc/localtime

2, then use the main ntpdate command to synchronize with the time server

#

/usr/sbin/ntpdate ntp.sjtu.edu.cn

3, then the following command lock time


# /sbin /hwclock --systohc

4, the system time is written coms

#clock -w

————————————-Split Line ————&mdash ; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash;

solutions *:

============== run tzselect select the correct time zone

2. Edit /etc/sysconfig/clock and set it as follows:

ZONE=”Asia/Shanghai”

UTC=false

ARC= falsehwclock -w write hardware time /etc/init.d/crond restart

& mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; parting line & mdash; & mdash; & mdash; & mdash; —&mda sh; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & ndash;

Ubuntu:

1, select the time zone

sudo dpkg-reconfigure tzdata

Then follow the prompts to select the serial number corresponding to Asia. After the selection, some new prompts will be displayed -> Enter the city name, such as Shanghai or Chongqing.

2, the time required to set the system

and finally with sudo date -s & ldquo; & rdquo; to modify the local time.

3. Save time setting

After selecting the time zone according to the prompt, execute cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime to change the time to Chinese standard time.

This command takes effect immediately. Running this command prevents the time zone from changing after the system is restarted.

——— Liang Ge Summary

Copyright © Windows knowledge All Rights Reserved