CentOS 6th time, time zone, settings modification and time synchronization

Source: Internet
Author: User

One, time zone

Show Time zone

Date--help Get help

Date-r

Date +%z

All of the above two commands can be

[Plain]View Plaincopyprint?
    1. [Email protected] ~]# date-r; Date +%z
    2. Fri, Oct 2012 23:34:27 +0800
    3. +0800
[Email protected] ~]# date-r; Date +%zfri, Oct 2012 23:34:27 +0800+0800

The main is the back of the +0800, East eight district

Modify Time Zone

[Plain]View Plaincopyprint?
    1. Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime

The time zone information exists/usr/share/zoneinfo/below, the local time zone information exists/etc/localtime, using the TAB key technique, can modify the time zone arbitrarily

Tzselect, interactive command, but it seems to be not very good, or use the above bar.

Second, time

Concept: Linux time has two

System time: Also called software time (SYS), January 1, 1970 to the current time of the number of seconds

Bois time: Also called hardware time (HC)

Show time

[Plain]View Plaincopyprint?
    1. [Email protected] ~]# Date;hwclock-r
    2. Friday, October 19, 2012 23:39:44 CST
    3. October 19, 2012 Friday 23:39 45 sec -0.317993 seconds
[[email protected] ~]# date;hwclock-r2012 October 19 Friday 23:39:44 CST2012 year October 19 Friday 23:39 45 seconds -0.317993 seconds

Set the time

1, Date-s

[Plain]View Plaincopyprint?
    1. Date-s 20121019
Date-s 20121019
[Plain]View Plaincopyprint?
    1. Date-s 23:40:00
Date-s 23:40:00
You can use this without a network.

2, Ntpdate

[Plain]View Plaincopyprint?
    1. Ntpdate time.windows.com && hwclock-w
Ntpdate time.windows.com && hwclock-w

Network update time, if successful, will system time, write Bois

Hwclock-w or Hwclock--SYSTOHC

Can do crontab.

3, start the NTPD service, opened after 2 can not be used.

Update with Ntpdate first, make sure time is not too different

Rpm-qa | grep NTP #查询一下可安装了

Chkconfig--list | grep NTP #看下服务情况

CHKCONIFG ntpd on

Service ntpd start or/etc/init.d/ntpd start

If necessary, set the/etc/ntp.conf, and then reload the service.

The knowledge of NTP refer to the server chapter of Brother Bird.

CentOS 6th time, time zone, settings modification and time synchronization

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.