If nothing is set, this should happen, but since I am Japanese and live in Tokyo, Tokyo time is good.
$ date
Fri Jun 12 04:32:25 UTC 2020
--Environment: CentOS Linux release 7.8.2003 (Core)
#localtime is linked to UTC
$ ls -la /etc/localtime
lrwxrwxrwx. 1 root root 25 Feb 29 12:11 /etc/localtime -> ../usr/share/zoneinfo/UTC
#When I searched for Japan for a moment, I found "Asia" and "Japan".
$ ls -la /usr/share/zoneinfo/ | grep -e Asia -e Japan
drwxr-xr-x. 2 root root 4096 Feb 29 12:06 Asia
-rw-r--r--. 2 root root 292 Sep 26 2019 Japan
# `Asia/Tokyo`But`Japan`It seems that it is not linked to
$ ls -la /usr/share/zoneinfo/Asia/ | grep Tokyo
-rw-r--r--. 2 root root 292 Sep 26 2019 Tokyo
Reference: [Linux] Timezone change --Qiita
#Overwrite symbolic links in Tokyo
$ ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
$ ls -la /etc/localtime
lrwxrwxrwx. 1 root root 30 Jun 15 10:45 /etc/localtime -> /usr/share/zoneinfo/Asia/Tokyo
$ date
Mon Jun 15 10:45:55 JST 2020
Reference: [[timedatectl] command-Display / set time: Linux basic command Tips (312)-@IT](https://www.atmarkit.co.jp/ait/articles/1906/13/news007. html)
$ timedatectl
Local time: Tue 2020-06-30 06:20:07 UTC
Universal time: Tue 2020-06-30 06:20:07 UTC
RTC time: Tue 2020-06-30 06:20:07
Time zone: UTC (UTC, +0000)
...abridgement...
#If you look for something that looks like Japan, "Asia"/There was "Tokyo"
$ timedatectl list-timezones | grep -i -e japan -e tokyo
Asia/Tokyo
#Set the time zone to "Asia"/Set to "Tokyo"
$ sudo timedatectl set-timezone Asia/Tokyo
$ timedatectl
Local time: Tue 2020-06-30 15:21:18 JST
Universal time: Tue 2020-06-30 06:21:18 UTC
RTC time: Tue 2020-06-30 06:21:18
Time zone: Asia/Tokyo (JST, +0900)
...abridgement...
$ date
Tue Jun 30 15:21:31 JST 2020
Recommended Posts