How to modify Linux system time Ubuntu
Two-step (1) Date 102718362009
The first step is to set the time, you can use the Date command to view the right ... Note that it is the year of the month
The second step means the RTC chip that is written to the motherboard.
Su-c ' date-s month/day/year '
Su-c ' date-s: minutes: Seconds '
Understanding the Linux Clock
Since the Linux clock and Windows clock are very different from the concept of classification, use to settings, so figuring out how the Linux clock works and set up operations, not only for the Linux beginners have great significance, but also for users who use Linux server is particularly important.
Classification of Linux Clocks
Windows clocks may be familiar, and Linux clocks are conceptually similar to Windows clocks displaying the current system time, but they differ from windows in terms of clock sorting and setting. Unlike Windows, Linux divides the clock into both the system clock (systems Clock) and the hardware (real time Clock, the RTC) clock. System time is the clock in the current Linux kernel, and the hardware clock is the battery-powered motherboard hardware clock on the motherboard, which can be set in the BIOS Standard BIOS feture.
Since Linux has two clock systems, what kind of clock system do you use for Linux by default? There will be no return of two system clock conflicts. These doubts and worries are not unreasonable. First, Linux does not have a default clock system. When Linux is started, the hardware clock will read the system clock settings, and the system clock will be independent of the hardware operation.
From the Linux boot process, the system clock and the hardware clock do not conflict, but all the commands in Linux (including functions) are set by the system clock. Not only that, the system clock and hardware clock can also be asynchronous, as shown in Figure 1, where the system time and hardware time can be different. The benefits of doing so are not significant for ordinary users, but they are useful for Linux network administrators. For example, to synchronize servers in a large network (spanning several time zones), if a Linux server in New York and a Linux server in Beijing, one server does not need to change the hardware clock to set a system time temporarily, if the time on the Beijing server is set to New York time, After the two servers complete the synchronization of the files, and then synchronized with the original clock can be. This gives the system and hardware clock a more flexible operation.
Set up a Linux clock
In Linux, the commands for clock viewing and setting are mainly date, hwclock, and clock. The clock and hwclock usages are similar, except that the clock command supports the Alpha hardware system in addition to the x86 hardware system. Because most users currently use the x86 hardware system, these two commands can be viewed as a command to learn.
1. Use the date command in the virtual terminal to view and set the system time
To view the operation of the system clock:
To set the system clock operation:
# date 091713272003.30
# Date month, year. seconds
2. View and set the hardware clock using the Hwclock or clock command
To view the operation of the hardware clock:
# Hwclock--show or
September 17, 2003 Wednesday 13:24 11 sec -0.482735 seconds
To set the hardware clock operation:
# Hwclock--set--date= "09/17/2003 13:26:00"
# clock--set--date= "09/17/2003 13:26:00"
Common formatting: Hwclock/clock--set--date= "month/day/year: min: sec".
3. Sync system clock and hardware clock
Linux System (the author is using Red Hat 8.0, other systems did not do experiments) after the default reboot, the hardware clock and the system clock synchronization. If it is not easy to reboot (the server usually rarely restarts), use the clock or hwclock command to synchronize the system clock and hardware clock.
The hardware clock synchronizes with the system clock:
In the above command,--hctosys represents hardware Clock to SYStem Clock.
system clock and Hardware clock sync:
Set the time using the Graphical System Setup tool
For beginners, the author recommends using a graphical clock setting tool, such as the date and time setting tool in red Hat 8.0, the "redhat-config-time" command in the virtual terminal, or "k Menu/System setup/Date and time" to start the date-time Setup tool. Using the tool eliminates the need for system time and hardware time, just set the date time from the dialog box to set up and modify the system clock and hardware clock at the same time.
Internet Sync Clock settings
There is a feature in the Windows XP date and time settings that synchronizes with the Internet, and with this feature, you get a very accurate time when you're online. Red Hat 8.0 also provides the ability to have a "Enable Network Time Protocol" option in the lower part of the date and Time Settings Tool dialog box, which allows you to use the Network Time protocol to synchronize the Linux system clock. When this item is selected, the Server Drop-down list box below it becomes available, from which you can select a time server as the remote time server. Then click the OK button to connect to the set time server and synchronize time with it.