Linux Detailed modify the system time
(1) date 042612492005
(2) hwclock -w
The first step is to set the mean time, you can view the set finished with the date command right ... note the month, day, hour Year
The second step is to write the meaning of the motherboard rtc chip ..
su -c 'date -s month / day / year'
su -c 'when the date -s: minutes: seconds'
Learn Linux clock
Because Linux and Windows Clock clock from the classification concept, the use of the set are very different, so find out ways of working with Linux clock setting operation, not only of great significance for Linux beginners, but also for the use of Linux server users. it is particularly important.
Classification Linux clock
We may be very familiar with the clock, Linux clock is conceptually similar to the Windows clock displays the current system time, but the clock was set and the classification and Windows different. And the difference is Windows, Linux into the clock system clock (System Clock) and hardware (Real Time Clock, referred to as RTC) clock two kinds. The system time is the current Linux Kernel clock and the hardware clock on the motherboard is powered by a battery of the motherboard hardware clock, the clock can be set in the BIOS "Standard BIOS Feture" item.
Since Linux has two clock systems, then Linux you are using the default clock system which use it? We will not return to the case of the two systems clock conflict happen? These questions and worried. First, Linux and no default system clock. When Linux boots, to read the hardware clock system clock setting, and then the system clock will be independent of the hardware operations.
From the Linux boot process, the system clock and the hardware clock does not conflict, but all Linux commands (including function) are based on the system clock settings. Moreover, the system clock and the hardware clock can also use asynchronous mode, as shown in Figure 1, the system time and hardware time may be different. This has the advantage of little significance for the average user, but for Linux network administrator there is very useful. For example, to a large network (across several time zones) server synchronization, if located in New York and Beijing Linux server Linux servers, one of the servers without having to change the hardware clock and set up a temporary system time only, such as synchronized time setting on the server to Beijing to New York time, two servers to complete the file, and then click to sync with the original clock. Such systems and hardware clock provides a more flexible operation.
Setting up Linux clock
Linux, the clock command to view and set the main date, hwclock, and clock. Wherein, clock and hwclock usage is similar, except that in addition to support for x86 hardware clock command system, also supports Alpha hardware system. Since the vast majority of users use the x86 hardware architecture, it is possible depending on these two commands to a command to learn.
1. Use the date command in a virtual terminal to view and set the system time
Check the operation of the system clock:
Set the system clock operation:
# Date 091713272015.30
# Date Month Day Year midnight. Seconds
2. Use the clock or hwclock command to view and set the hardware clock
Check the hardware clock operation:
# Hwclock --show or
# Clock --show
September 17, 2015 Wednesday 13:24:11 -0.482735 seconds
Set the hardware clock operation:
# Hwclock --set --date = "09/17/2015 13:26:00"
# Clock --set --date = "09/17/2015 13:26:00"
General format: hwclock / clock --set --date = "month / day / year hours: minutes: seconds."
3. To synchronize the system clock and the hardware clock
Linux system (I use the Red Hat 8.0, other systems have not done experiments) default after restart, hardware clock and system clock synchronization. If it was not convenient, then restart (reboot the server usually less), use the clock or hwclock command to synchronize the system clock and the hardware clock.
Hardware clock and system clock synchronization:
# Hwclock --hctosys
# Clock --hctosys
The above command, - hctosys represents Hardware Clock to SYStem clock.
System clock and the hardware clock synchronization:
# Hwclock --systohc
# Clock --systohc