首页 >> Linux >> 内容页

使用timedateclt修改ubuntu20.04系统的时区

查看当前时区

1.timedatectl
输出:

               Local time: Tue 2020-04-28 17:31:24 CST
           Universal time: Tue 2020-04-28 09:31:24 UTC
                 RTC time: Sun 2020-04-26 11:53:02
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: no

2./etc/localtime
ls -l /etc/localtime

输出:

lrwxrwxrwx 1 root root 35 Apr 28 17:31 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai

时区列表

timedatectl list-timezones

命令列出,所有可用的时区

设置时区

sudo timedatectl set-timezones Asia/Shanghai

将系统时区设置为上海(北京时间)