62
61

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Ubuntu16.04] timezoneの確認と設定

Last updated at Posted at 2017-06-01

Ubuntu16.04でのtimezoneの確認と設定方法メモ
timedatectl を使用すれば良いようです

コマンド

現在のtimezoneの確認
$ timedatectl
      Local time: Thu 2017-06-01 02:09:07 UTC
  Universal time: Thu 2017-06-01 02:09:07 UTC
        RTC time: Thu 2017-06-01 02:09:07
       Time zone: Etc/UTC (UTC, +0000)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no
設定値の一覧を確認
$ timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
...
timezoneの変更(永続的)
$ timedatectl set-timezone <タイムゾーン>

設定例

設定例(Etc/UTC=>Asia/Tokyo)
ubuntu@ubuntu-xenial:~$ timedatectl
      Local time: Thu 2017-06-01 02:09:07 UTC
  Universal time: Thu 2017-06-01 02:09:07 UTC
        RTC time: Thu 2017-06-01 02:09:07
       Time zone: Etc/UTC (UTC, +0000)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

ubuntu@ubuntu-xenial:~$ sudo timedatectl set-timezone Asia/Tokyo

ubuntu@ubuntu-xenial:~$ timedatectl
      Local time: Thu 2017-06-01 11:09:47 JST
  Universal time: Thu 2017-06-01 02:09:47 UTC
        RTC time: Thu 2017-06-01 02:09:47
       Time zone: Asia/Tokyo (JST, +0900)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

その他

/etc/localtime のリンクを変更する方法もあるようですが、上記の方法でも永続的な変更ができたため、個人的にはUbuntuではtimedatectlでのやり方のほうが良い気はします。
【Linux】タイムゾーン(Timezone)の変更 - Qiita

参考

Ubuntu 16.04 LTS : システムのタイムゾーンを設定する : Server World

62
61
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
62
61

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?