{"id":3249,"date":"2012-05-30T22:11:38","date_gmt":"2012-05-30T14:11:38","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=3249"},"modified":"2023-04-28T09:49:16","modified_gmt":"2023-04-28T09:49:16","slug":"how-to-change-timezone-linux","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-change-timezone-linux\/","title":{"rendered":"How to Change Timezone Linux on RHEL 6\/7 and CentOS 6\/7"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone wp-image-6840 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/05\/How-to-Change-Timezone-Linux-on-RHEL.jpg\" alt=\"change timezone linux\" width=\"2560\" height=\"1440\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/05\/How-to-Change-Timezone-Linux-on-RHEL.jpg 2560w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/05\/How-to-Change-Timezone-Linux-on-RHEL-300x169.jpg 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/05\/How-to-Change-Timezone-Linux-on-RHEL-768x432.jpg 768w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/05\/How-to-Change-Timezone-Linux-on-RHEL-1024x576.jpg 1024w\" data-sizes=\"(max-width: 2560px) 100vw, 2560px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 2560px; --smush-placeholder-aspect-ratio: 2560\/1440;\" \/><\/p>\n<p>This post assumed that we will change the System Timezone from the command line without using redhat-config-date.<\/p>\n<p>There are several files and directories that are used for time zones. In RHEL 6 and RHEL 6, there is one directory that very useful to select the appropriate time zone which is <strong>\/usr\/share\/zoneinfo<\/strong> directory.<\/p>\n<p>Sometimes we forget to set the correct time zone for the new linux system. This quick steps show how to change timezone on RHEL 6\/7 and CentOS 6\/7.<\/p>\n<p><strong>\/usr\/share\/zoneinfo<\/strong> &#8211; this directory contains the System Timezone files that were compiled by zic. These are binary files and cannot be viewed with a text viewer. The files contain information such as rules about DST. They allow the kernel to convert UTC UNIX time into appropriate local dates and times.<\/p>\n<p>In order to change the System Timezone of your system you will need to access the file or configuration using root.<\/p>\n<h2>How to Change Timezone Linux on RHEL \/ CentOS<\/h2>\n<p>1) How to list all available time zone on RHEL 6 \/ CentOS 6:<\/p>\n<pre>#ls \/usr\/share\/zoneinfo\r\n<\/pre>\n<p>2) How to list all available time zone on RHEL 7 \/ CentOS 7:<\/p>\n<pre># timedatectl list-timezones | grep Asia\r\nAsia\/Aden\r\nAsia\/Almaty\r\nAsia\/Amman\r\n..\r\n..\r\nAsia\/Kuala_Lumpur\r\n<\/pre>\n<p>3) How to check timezone in linux RHEL 6 \/ CentOS 6 :<\/p>\n<pre># cat \/etc\/sysconfig\/clock\r\n<\/pre>\n<p>4) How to check timezone in linux RHEL 7 \/ CentOS 7 :<\/p>\n<pre># timedatectl status\r\n      Local time: Thu 2017-01-05 20:00:22 MYT\r\n  Universal time: Thu 2017-01-05 12:00:22 UTC\r\n        RTC time: n\/a\r\n       Time zone: Asia\/Kuala_Lumpur (MYT, +0800)\r\n     NTP enabled: n\/a\r\nNTP synchronized: no\r\n RTC in local TZ: no\r\n      DST active: n\/a\r\n<\/pre>\n<p>5) How to Change Timezone Linux RHEL 6 \/ CentOS 6 :<\/p>\n<p>Edit <strong>ZONE=<\/strong> to the following:<\/p>\n<pre># cat \/etc\/sysconfig\/clock\r\n<\/pre>\n<pre>ZONE=\"Asia\/Kuala_Lumpur\"\r\n<\/pre>\n<p>Create a new soft link to your time zone :<\/p>\n<pre># mv \/etc\/localtime \/root\/localtime.old\r\n# ln -sf \/usr\/share\/zoneinfo\/Asia\/Kuala_Lumpur \/etc\/localtime\r\n<\/pre>\n<p>6) How to Change Timezone Linux RHEL 7 \/ CentOS 7 :<\/p>\n<pre>timedatectl set-timezone Asia\/Kuala_Lumpur\r\n<\/pre>\n<p>7) How to Display current date and time and timezone :<\/p>\n<pre># date\r\nThu Jan  5 19:54:38 MYT 2017\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This post assumed that we will change the System Timezone from the command line without using redhat-config-date. There are several files and directories that are used for time zones. In&#8230;<\/p>\n","protected":false},"author":6,"featured_media":6840,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055,2058],"tags":[1251,1258,1434,1546,1715,1717],"class_list":["post-3249","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-rhel","tag-centos-6","tag-centos-7","tag-how-to-change-timezone-linux","tag-linux-utilities","tag-rhel-6","tag-rhel-7"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/3249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=3249"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/3249\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/6840"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=3249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=3249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=3249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}