CentOS 7 Set time command Timedatectl usage example

Source: Internet
Author: User
Tags current time time zones local time set time time and date timezones centos

In the new CENTOS7, the instruction on time adds a unified command Timedatactl, in addition to keeping the date, Hwclock, and other commands commonly used in previous versions. Below is a summary of the following in conjunction with its usage.

View TIMEDATECTL instruction Usage Help

The code is as follows Copy Code
[Root@361way ~]# Timedatectl--help
Timedatectl [OPTIONS ...] COMMAND ...
Query or change the system time and date settings.
-H--help Show this Help
--version Show Package version
--adjust-system-clock
Adjust system clock When changing local RTC mode
--no-pager don't pipe output into a pager
-P--privileged acquire privileges before execution
--no-ask-password don't prompt for password
-H--host=[user@]host Operate on remote host
Commands:
Status Show Current time settings
Set-time Time Set system time
Set-timezone ZONE Set System timezone
List-timezones Show known TimeZones
SET-LOCAL-RTC Boolean Control whether RTC
SET-NTP BOOL Control whether NTP is enabled


More detailed help information can also be viewed through the man timedatectl.

View current settings, direct input timedatectl equivalent to TIMEDATECTL status

  code is as follows copy code
[root@361way ~] # timedatectl
      local time:wed 2014-09-24 21:19:26 CST
  Universal time:wed 20 14-09-24 13:19:26 UTC
        RTC time:wed 2014-09-24 13:19:26
         Timezone:asia/shanghai (CST, +0800)
     NTP Enabled:yes
NTP synchronized:yes
 RTC in local tz:no
      DST active:n/a


Set Date

Timedatectl set-time yyyy-mm-dd
Set current time

Timedatectl set-time HH:MM:SS
Default, when the system is in use UTC , you can turn UTC time on and off by using the following command:

Timedatectl SET-LOCAL-RTC Boolean
Substituting Boolean for Yes to use local time, replace with no to indicate UTC time

Note: This Boolean value can also be used to set the time zone with true, Flase

:

To view all time zones:

Timedatectl list-timezones
To set the time zone under the command:

Timedatectl set-timezone time_zone
Remote NTP server synchronization

Timedatectl can also set whether to turn on NTP options

Timedatectl set-ntp Boolean
The Boolean here is yes or no

In addition to the above usage, TIMEDATECTL also supports the time setting of a remote host through the-H parameter.

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.