Help us understand the problem. What is going on with this article?

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

More than 3 years have passed since last update.

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

koara-local
言語は最近は C#, Javaあたりがメイン。端末VimからIDEに移行。IntelliJすごい。Qiitaでの記事やその中の主張は、所属している企業/団体の意見を代表するものではありません。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした