(1) modify the system time zone 1. view the current time zone # vi/etc/sysconfig/clock2. method for modifying and setting the time zone 1: # tzselect Method 2: RedHatLinux and CentOS only) # timeconfig3. copy the corresponding time zone file, replace the system default time zone # cp/usr/share/zoneinfo/$ Main time zone/$ time zone/etc/localtime for medium (1) modify system Time Zone 1. view current time zone
# Vi/etc/sysconfig/clock
2. modify the time zone setting method
Method 1: # tzselect
Method 2: Limited to RedHat Linux and CentOS)
# Timeconfig
3. copy the corresponding time zone file to replace the default time zone of the system.
# Cp/usr/share/zoneinfo/$ Main time zone/$ time zone/etc/localtime
For servers in China, run: # cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime
4. write the current time into the BIOS for permanent effect (to prevent failure after restart)
# Hwclock
(2) run the "date-s" command to modify the system time"
For example, the command to set the system time to June 10, 1996 is as follows.
# Data-s 06/10/96
The command to set the system time to 01:12:00 P.M. is as follows.
# Date-s 13:12:00
--- Note that the system time is maintained by the operating system in linux.
---- When the system is started, the Linux operating system reads the time from CMOS to the system time variable. later, the modification time is implemented by modifying the system time. To maintain the consistency between the system time and the CMOS time, Linux writes the system time to the CMOS at intervals. Because the synchronization is performed at intervals (about 11 minutes), after we execute date-s, if the machine is restarted immediately, the modification time may not be written to CMOS, this is the cause of the problem. To make sure the modification takes effect, run the following command:
# Clock-w
This command forces the system time to be written into CMOS.