Skip to content

Instantly share code, notes, and snippets.

@bnse
Created September 8, 2021 09:11
Show Gist options
  • Select an option

  • Save bnse/fe58e5ea9a6eb10b584fb2a82939b620 to your computer and use it in GitHub Desktop.

Select an option

Save bnse/fe58e5ea9a6eb10b584fb2a82939b620 to your computer and use it in GitHub Desktop.
set timezone on ubuntu

set-timezone on ubuntu

Show current timezone status:

$ timedatectl show

Timezone=Asia/Shanghai
LocalRTC=no
CanNTP=yes
NTP=yes
NTPSynchronized=yes
TimeUSec=Wed 2021-09-08 16:53:35 CST
RTCTimeUSec=Wed 2021-09-08 16:53:35 CST
$ timedatectl status

               Local time: Wed 2021-09-08 16:53:50 CST
           Universal time: Wed 2021-09-08 08:53:50 UTC
                 RTC time: Wed 2021-09-08 08:53:50
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

List timezones:

$ timedatectl list-timezones |grep -i shanghai

Asia/Shanghai

Set timezone:

$ sudo timedatectl set-timezone  Asia/Shanghai

Unix 的习惯是如果没有返回任何信息表示成功!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment