ubuntu2020.04|linux修改时区|中国时间

使用timedatectl命令来修改时区。

直接输入timedatectl可以看到当前时区是UTC。

               Local time: Fri 2020-08-14 05:58:08 UTC
           Universal time: Fri 2020-08-14 05:58:08 UTC
                 RTC time: Fri 2020-08-14 05:58:08    
                Time zone: Etc/UTC (UTC, +0000)       
System clock synchronized: yes                        
              NTP service: active                     
          RTC in local TZ: no                    

查看时区地区

timedatectl list-timezones

可以看到如下列表

Africa/Abidjan
Africa/Accra
Africa/Algiers
Africa/Bissau
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/El_Aaiun
Africa/Johannesburg
Africa/Juba
Africa/Khartoum
Africa/Lagos
Africa/Maputo
Africa/Monrovia
Africa/Nairobi
Africa/Ndjamena
...

在找到Asia/Shanghai使用set-timezone命令设置

sudo timedatectl set-timezone Asia/Shanghai

再次查看结果。本地时间已经变成CST了。

               Local time: Fri 2020-08-14 14:04:53 CST
           Universal time: Fri 2020-08-14 06:04:53 UTC
                 RTC time: Fri 2020-08-14 06:04:53    
                Time zone: Asia/Shanghai (CST, +0800) 
System clock synchronized: yes                        
              NTP service: active                     
          RTC in local TZ: no       

你可能感兴趣的:(Experience,基础建站,ubuntu,linux,datetimectl)