zoukankan      html  css  js  c++  java
  • CentOS 7 时区设置 timedatectl

    [root@testandy ~]# timedatectl --help

    timedatectl [OPTIONS...] COMMAND ...

    Query or change system time and date settings.

    -h --help Show this help message
    --version Show package version
    --no-pager Do not pipe output into a pager
    --no-ask-password Do not prompt for password
    -H --host=[USER@]HOST Operate on remote host
    -M --machine=CONTAINER Operate on local container
    --adjust-system-clock Adjust system clock when changing local RTC mode

    Commands:
    status Show current time settings
    set-time TIME Set system time
    set-timezone ZONE Set system time zone
    list-timezones Show known time zones
    set-local-rtc BOOL Control whether RTC is in local time
    set-ntp BOOL Control whether NTP is enabled

    设置时区同样, 在 CentOS 7 中, 引入了一个叫 timedatectl 的设置设置程序.
    用法很简单:

    timedatectl # 查看系统时间方面的各种状态

    $timedatectl status
    Local time: 四 2014-12-25 10:52:10 CST
    Universal time: 四 2014-12-25 02:52:10 UTC
    RTC time: 四 2014-12-25 02:52:10
    Timezone: Asia/Shanghai (CST, +0800)
    NTP enabled: yes
    NTP synchronized: yes
    RTC in local TZ: no
    DST active: n/a
    
    timedatectl list-timezones # 列出所有时区
    timedatectl set-local-rtc 1 # 将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间
    timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
    

    其实不考虑各个发行版的差异化, 从更底层出发的话, 修改时间时区比想象中要简单:

    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
  • 相关阅读:
    学习笔记之19-static和extern关键字1-对函数的作用
    学习笔记之18-变量类型
    学习笔记之17-预处理指令3-文件包含
    学习笔记之16-预处理指令2-条件编译
    背包问题
    kali linux 忘记root密码重置办法
    wp8数据存储--独立存储文件 【转】
    线段树入门【转】
    线段数【转】
    大数阶乘算法【转】
  • 原文地址:https://www.cnblogs.com/linuxandy/p/10877003.html
Copyright © 2011-2022 走看看