CentOS system modification time
Operation:
12
date
–s
'1987-05-02 10:10:10'
clock –w
//
Write date into CMOS
Supplement:
Linux modification usually involves three commands:
123
date
: Modify the current system time
Clock: Modify the CMOS time (view the CMOS time: clock-r)
Hwclock: modifies the system hardware time.
Hwclock usage:
12
hwclock --show
//
View hardware clock
hwclock --
set
--
date
=
"1/23/01 22:16:59"
//
Set hardware clock
The hardware time is basically a CMOS clock, and the system time is maintained by the kernel. It is from the end of 1969 (that is, the dawn of the legendary Unix era) the cumulative number of seconds from the start.
In DOS or Mac systems, hardware clock is used. Unfortunately, you may have discovered that most computer clocks are inaccurate. Basically, they are alarm clocks powered by small batteries. These lithium batteries are generally able to provide power for about three years. At that time, almost all of your systems were outdated. In Linux, the system clock is used. At startup, it obtains the timing start point by reading the hardware clock, rather than by memory timing.
You can modify the system hardware clock through the BIOS, or use the hwclock command if you do not want to restart the machine.
The hardware clock is usually set to the Global Standard Time (UTC ), save the time zone information in a proper file in the/usr/share/lib/timezone (or in some systems, it may be/usr/local/timezone) directory, then link the file/etc/localtime to it with a symbol. Actions under CentOS:
123
ln
-sf
/usr/share/zoneinfo/Asia/Chongqing
/etc/localtime
//
Corrected Time Zone
date
–s
'2011-11-23 22:34:10'
//
Set Time
clock –w
//
Write time to CMOS
I. Time Zone
1. view the current time zone
Date-R
2. Modify the time zone
Method (1)
Tzselect
Method (2) Limited to RedHat Linux and CentOS Systems
Timeconfig
Method (3) applicable to Debian
Dpkg-reconfigure tzdata
3. Copy the corresponding time zone file, replace the CentOS System Time Zone file, or create a link file.
Cp/usr/share/zoneinfo/$ main Time Zone/$ Time Zone/etc/localtime
Available in China:
Cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime
Ii. Time
1. view the time and date
Date
2. Set the time and date
Set the CentOS system date to the June 10, 1996 command
Data-s 06/22/96
Set the CentOS system time to 01:52:00 P.M..
Date-s 13:52:00
3. Write the current time and date to the BIOS to prevent failure after restart
Hwclock-w
Iii. Scheduled synchronization time
#/Usr/sbin/ntpdate 210.72.145.44>/dev/null 2> & 1