View modify Linux time zone and time

Source: Internet
Author: User

View/modify Linux time zone and time
  One, time zone
1. View the current time zone
Date-r
2. Modify the settings time zone
Method (1)
Tzselect
Method (2) limited to Redhat Linux and CentOS
Timeconfig
Method (3) applies to Debian
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
Can be used in China:
Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
  Second, time
1. Check the time and date
Date
2. Set time and date
command to set the system date to June 10, 1996
Date-s 06/22/96
command to set the system time to 1:52 P.M. 0 seconds
Date-s 13:52:00
3. Write the current time and date to the BIOS to avoid failure after reboot
Hwclock-w
  Three, timing synchronization time
* * * * * */usr/sbin/ntpdate 210.72.145.44 >/dev/null 2>&1

In Linux, the commands used for clock viewing and setting are mainly date, hwclock, and clock. Among them, clock and hwclock usage similar, only one on the line, but clock command in addition to support x86 hardware system, but also support the Alpha hardware system.

To view Linux system time:
Date
To modify the Linux system time:
Date-s (back and time)

To view Linux hardware time:
Hwclock
Or
Clock
Or
Hwclock–show
Or
Clock–show

To modify the Linux hardware time:
Hwclock–set–date
Or
Clock–set–date

To synchronize the system time with the hardware clock, use:
Hwclock–hctosys
Or
Clock–hctosys

Instead, let the hardware clock synchronize with the system time:
Hwclock–systohc
Or
Clock–systohc

Allow the system time to synchronize hardware time every 10 minutes.

[Email protected] root]$ vi/etc/crontab    shell=/bin/bash  path=/sbin:/bin:/usr/sbin:/usr/bin  mailto= Root  home=/    # run-parts * * * * *  root run-parts/etc/cron.hourly  4 * * * Root Run-parts/etc/cron.dai LY  4 * * 0 root run-parts/etc/cron.weekly  4 1 * * Root run-parts/etc/cron.monthly */10 * * * *  root HW Clock--hctosys  #我加入了这么一行, which indicates that Hwclock--hctosys is performed every 10 minutes.

View modify Linux time zone and time

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.