Linux System Time settings

Source: Internet
Author: User

  The Linux clock is divided into system clocks (systems Clock) and hardware (real time Clock, short RTC) clocks. the system clock is the clock in the current Linux kernel, and the hardware clock is the battery-powered clock on the motherboard, which can be set in the BIOS. When Linux is started, the hardware clock will read the system clock settings, and the system clock will be independent of the hardware operation.

All the commands (including functions) in Linux are set by the system clock. In Linux, the commands for clock viewing and setting are mainly date, hwclock, and clock. Among them, clock and hwclock usage is similar, only use one on the line, except that the clock command supports the Alpha hardware system in addition to the x86 hardware system.

  1. Date

View system time

# date

Set system time

# date–set ' 07/07/06 10:19″ (month/day/year: minutes: SEC)

  2, Hwclock/clock

View hardware Time

# Hwclock–show

or # Clock–show

Set Hardware time

# hwclock–set–date= ' 07/07/06 10:19″ (month/day/year: minutes: SEC)

or # clock–set–date= ' 07/07/06 10:19″ (month/day/year: minutes: SEC)

  3, hardware time and system time synchronization

According to the previous version, reboot the system, the hardware time will read the system time, to achieve synchronization, but without restarting, you need to use the Hwclock or clock command to achieve synchronization.

The hardware clock synchronizes with the system clock: # Hwclock–hctosys (HC represents hardware time, SYS represents system time) or # Clock–hctosys

system clock and Hardware clock sync: # HWCLOCK–SYSTOHC or # CLOCK–SYSTOHC

  4, Time zone settings

# Tzselect

Please identify a location so this time zone rules can be set correctly. Please select a continent or ocean.

1) Africa

2) Americas

3) Antarctica

4) Arctic Ocean

5) Asia

6) Atlantic Ocean

7) Australia Europe

9) Indian Ocean

) Pacific Ocean

One) None–i want to specify the time zone using the Posix TZ format.#?

Input 5, Asia

Please select a country.

1) Afghanistan

) Israel

) Palestine

2) Armenia

) Japan

Philippines)

3) Azerbaijan

) Jordan

Notoginseng) Qatar

4) Bahrain

) Kazakhstan

Russia)

5) Bangladesh

Korea (north)

Saudi Arabia

6) Bhutan

) Korea (South)

) Singapore

7) Brunei

) Kuwait

) Sri Lanka Cambodia

) Kyrgyzstan

) Syria

9)

) Laos

Taiwan)

Cyprus)

) Lebanon

) Tajikistan

One) East Timor

MACAU)

Thailand)

) Georgia

Malaysia)

Turkmenistan)

Mr Kong

) Mongolia

) United Arab Emirates

) India

Myanmar (Burma)

Uzbekistan)

) Indonesia

Nepal)

Vietnam)

) Iran

Oman)

m) Yemen

Iraq)

pakistan#?

Input 9, China

Please select one of the following time zone regions.

1 East China–beijing, Guangdong, Shanghai, etc.

2) Heilongjiang

3) China–gansu, Guizhou, Sichuan, Yunnan, etc.

4) Tibet & most of Xinjiang Uyghur5) southwest Xinjiang Input 1, the

The following information has been given:

East China–beijing, Guangdong, Shanghai, etc.

Therefore tz= "Asia/shanghai" would be used. Local Now:fri June 7 10:32:18 CST 2006.Universal time is Now:fri June 7 02:32:18 UTC 2006.Is The above information Ok?

1) Yes

2) no#?

Enter 1 to confirm

If you do not use the Tzselect command, you can modify the file change time zone.

# Vi/etc/sysconfig/clock Zone=asia/shanghai (check/usr/share/zoneinfo the file below) Utc=false Arc=false

# Rm/etc/localtime

# Ln-sf/usr/share/zoneinfo/asia/shanghai/etc/localtime

Reboot can be done.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.