CentOS Time View Modify Command date explanation

Source: Internet
Author: User

1. Viewing and modifying the Linux time zone and time


One, the Linux time zone view and the modification


1. View the current time zone
Date-r

2. Modify the setting time zone
Method 1:
Tzselect

Method 2:
Redhat Linux and CentOS only
Timeconfig

Method 3:
Suitable for 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, the Linux time viewing and modification


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/10/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

The commands used in Linux for clock viewing and setup 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

[HTML] view Plaincopyprint?

    1. Hwclock–hctosys
    2. #或
    3. Clock–hctosys



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

To view Linux hardware time:

Java code
[HTML]View Plaincopyprint?
    1. Hwclock
    2. #或
    3. Clock
    4. #或
    5. Hwclock–show
    6. #或
    7. Clock–show

To modify the Linux hardware time:

C code

[CSharp]View Plaincopyprint?
    1. hwclock–set–date
    2. #或
    3. clock–set–date

To synchronize the system time with the hardware clock, use:

C code

[HTML]View Plaincopyprint?
    1. Hwclock–hctosys
    2. #或
    3. Clock–hctosys

Instead, let the hardware clock synchronize with the system time:

C code

[HTML]View Plaincopyprint?
    1. Hwclock–systohc
    2. #或
    3. Clock–systohc

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

C code
[HTML]View Plaincopyprint?
  1. [Email protected] root]$ Vi/etc/crontab
  2. Shell=/bin/bash
  3. Path=/sbin:/bin:/usr/sbin:/usr/bin
  4. mailto=Root
  5. home=/
  6. # Run-parts
  7. * * * * * Root run-parts/etc/cron.hourly
  8. 4 * * * Root run-parts/etc/cron.daily
  9. 4 * * 0 root run-parts/etc/cron.weekly
  10. 4 1 * * Root run-parts/etc/cron.monthly
  11. */10 * * * * root hwclock--hctosys #加入此行, Hwclock--hctosys every 10 minutes

CentOS Time View Modify Command date explanation

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.