Linux time modification does not restart modify time zone
First, the time to modify Linux
Root uses the date directive: Date-s
1, only modify the date, do not modify the time, input:
Linux Code
Date-s 2007-08-03
2, only modify the time, input:
Linux Code
Date-s 14:15:00
3, at the same time modify the date time, note to add double quotes, date and time between a space, input:
Linux Code
Date-s "2007-08-03 14:15:00"
4, after the modification, remember to enter:
Linux Code
Clock-w
Writes the system time to the CMOS
Second, modify the time zone does not restart
Under the root
1, copy the appropriate time zone files, replace the system time zone files:
Linux Code
cp/usr/share/zoneinfo/$ Primary time zone/$ secondary time zone/etc/localtime
For example:
Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
you may not be able to modify the time with the date command
. First find the file for the rotating time zone:/usr/share/zoneinfo/asia/shanghai replaces the file with this file/etc/localtime (note that you must distinguish between case or not, the small part of the file is not recognized.) Linux systems are case-sensitive)
2. Then modify the/etc/sysconfig/clock to read as follows:
Zone= "Asia/shanghai"
Utc=true
Arc=false
3. The following command can be executed again to correct:
/usr/sbin/ntpdate-u 0.asia.pool/ntp.org
4. Sometimes the above command bash reminds you that there are no files so you can install an NTP package
Yum Install-y ntp*
And then execute the 3 bash statement.