View/Modify system time zone, time under Linux

Source: Internet
Author: User
Tags time and date

One, view and modify the time zone of Linux 1. View current time zone

Command: "Date-r"

2. Modify the setup Linux Server time zone method A

Command: "Tzselect"

Method B is limited to Redhat Linux and CentOS

Command: "Timeconfig"

Method C applies to Debian

Command: "Dpkg-reconfigure tzdata"

3. Copy the appropriate time zone file, replace the system time zone file, or create a linked file

cp/usr/share/zoneinfo/$ main time zone/$ times time zone/etc/localtime

For example: In set China time zone use Asia/Shanghai (+8)

Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime

4. Note

GMT (Greenwich Mean Time, GMT):
Refers to the standard time of the Royal Greenwich Observatory, located in the outskirts of London, as the Prime meridian is defined through the meridians there.
UTC (Universal time/temps
Cordonné World Standard Time)
CST (Central Standard Time national standard Time, one to say Zhongyuan time); Chinese Standard Time (China
Standard Time)
GMT + 8 = UTC + 8 = CST

Second, the time to view and modify Linux

1. Date

View system time

# date

Setting the system time

# date--set "07/07/06 10:19" (Month/day/year: minutes: seconds)

Writes the current time and date to the BIOS to avoid failure after a restart

Command: "Hwclock-w"

2, Hwclock/clock

Viewing hardware time

# Hwclock--show

or # clock--show

Set Hardware time

# Hwclock--set--date= "07/07/06 10:19" (Month/day/year: minutes: seconds)

or # clock--set--date= "07/07/06 10:19" (Month/day/year: minutes: seconds)

3. Synchronization of hardware time and system time

According to the foregoing, reboot the system, hardware time will read the system time, to achieve synchronization, but do not restart, you need to use the Hwclock or clock command to achieve synchronization.

The hardware clock is synchronized with the system clock:

# Hwclock--hctosys (HC stands for hardware time, SYS represents system time)

Or

# clock--hctosys

system clock and Hardware clock sync: # hwclock--SYSTOHC or # clock--SYSTOHC

For China time zone, modify the operation as follows 1. Modify a file /etc/sysconfig/clockContent: Zone=asia/shanghai utc=false arc=false2. Rm/etc/localtimeln-sf/usr/share/zoneinfo/asia/shanghai/etc/localtime from:http://www.cnblogs.com/ningvsban/ Archive/2012/12/18/2823036.html

View/Modify system time zone, time under Linux

Related Article

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.