运维开发网

修改Debian 时区设置

运维开发网 https://www.qedev.com 2020-10-28 12:05 出处:51CTO 作者:vincentkp
使用“timedatectl”命令查看当前时区设置:$sudotimedatectlLocaltime:Mon2020-10-2620:34:21EDTUniversaltime:Tue2020-10-2700:34:21UTCRTCtime:Tue2020-10-2700:34:22Timezone:US/Eastern(EDT,-0400)Systemclocksynchronized:yes

使用 “timedatectl” 命令

查看当前时区设置:

$ sudo timedatectl
               Local time: Mon 2020-10-26 20:34:21 EDT
           Universal time: Tue 2020-10-27 00:34:21 UTC
                 RTC time: Tue 2020-10-27 00:34:22
                Time zone: US/Eastern (EDT, -0400)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no

时区命名通常使用“地区/城市”的格式,使用 timedatectl 列出 Debian 中的时区:

$ sudo timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
    ... 
Asia/Seoul
Asia/Shanghai
Asia/Singapore
    ...

找到我们需要的名称 【Asia/Shanghai】

修改时区:

$ sudo timedatectl set-timezone Asia/Shanghai

查看修改后的时区:

$ timedatectl
               Local time: Tue 2020-10-27 08:38:19 CST
           Universal time: Tue 2020-10-27 00:38:19 UTC
                 RTC time: Tue 2020-10-27 00:38:20
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no

$ date
Tue 27 Oct 2020 08:38:53 AM CST

完成~

扫码领视频副本.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号