{"id":715,"date":"2017-03-25T19:19:15","date_gmt":"2017-03-25T17:19:15","guid":{"rendered":"https:\/\/helia.ee\/koolitus\/?page_id=715"},"modified":"2017-03-25T19:19:15","modified_gmt":"2017-03-25T17:19:15","slug":"debian-8-methods-to-change-timezone-in-linux","status":"publish","type":"page","link":"https:\/\/helia.ee\/koolitus\/?page_id=715","title":{"rendered":"Debian 8 &#8211; Methods To Change TimeZone in Linux"},"content":{"rendered":"<div class=\"post_content\">\n<p><strong>Question:<\/strong> When I installed the Linux OS, I forgot to set the proper timezone. How do I change the timezone on my Linux distribution. I use CentOS (Red Hat Linux). But, can you please explain me how to do this on all Linux distributions with some clear examples.<\/p>\n<p><strong>Answer:<\/strong> Use one of the following methods to change the timezone on your Linux system. One of these methods should work for you depending on the Linux distribution you are using.<br \/>\n<span id=\"more-5843\"><\/span><\/p>\n<h3>Method 1: Change TimeZone Using \/etc\/localtime File<\/h3>\n<p>For this example, assume that your current timezone is UTC as shown below. You would like to change this to Pacific Time.<\/p>\n<pre># date\r\nMon Sep 17 22:59:24 UTC 2010\r\n<\/pre>\n<p>On some distributions (for example, CentOS), the timezone is controlled by \/etc\/localtime file.<\/p>\n<p>Delete the current localtime file under \/etc\/ directory<\/p>\n<pre># cd \/etc\r\n# rm localtime\r\n<\/pre>\n<p>All US timezones are located under under the \/usr\/share\/zoneinfo\/US directory as shown below.<\/p>\n<pre># ls \/usr\/share\/zoneinfo\/US\/\r\nAlaska          Arizona         Eastern         Hawaii          Michigan        Pacific\r\nAleutian        Central         East-Indiana    Indiana-Starke  Mountain        Samoa\r\n<\/pre>\n<p><strong>Note:<\/strong> For other country timezones, browse the \/usr\/share\/zoneinfo directory<\/p>\n<p><center><\/p>\n<div><\/div>\n<p><\/center>Link the Pacific file from the above US directory to the \/etc\/localtime directory as shown below.<\/p>\n<pre># cd \/etc\r\n# ln -s \/usr\/share\/zoneinfo\/US\/Pacific localtime\r\n<\/pre>\n<p>Now the timezone on your Linux system is changed to US Pacific time as shown below.<\/p>\n<pre># date\r\nMon Sep 17 23:10:14 PDT 2010\r\n<\/pre>\n<h3>Method 2: Change TimeZone Using \/etc\/timezone File<\/h3>\n<p>On some distributions (for example, Ubuntu), the timezone is controlled by \/etc\/timezone file.<\/p>\n<p>For example, your current timezone might be US Eastern time (New York) as shown below.<\/p>\n<pre># cat \/etc\/timezone\r\nAmerica\/New_York\r\n<\/pre>\n<p>To change this to US Pacific time (Los Angeles), modify the \/etc\/timezone file as shown below.<\/p>\n<pre># vim \/etc\/timezone\r\nAmerica\/Los_Angeles\r\n<\/pre>\n<p>Also, set the timezone from the command line using the TZ variable.<\/p>\n<pre># export TZ=America\/Los_Angeles\r\n<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Question: When I installed the Linux OS, I forgot to set the proper timezone. How do I change the timezone on my Linux distribution. I use CentOS (Red Hat Linux). But, can you please explain me how to do this on all Linux distributions with some clear examples. Answer: Use one of the following methods [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":621,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-715","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=715"}],"version-history":[{"count":1,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/715\/revisions"}],"predecessor-version":[{"id":716,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/715\/revisions\/716"}],"up":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/621"}],"wp:attachment":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}