{"id":13187,"date":"2019-04-01T07:06:15","date_gmt":"2019-04-01T07:06:15","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13187"},"modified":"2019-04-01T07:06:15","modified_gmt":"2019-04-01T07:06:15","slug":"how-to-set-time-timezone-and-synchronize-system-clock-using-timedatectl-command","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/how-to-set-time-timezone-and-synchronize-system-clock-using-timedatectl-command\/","title":{"rendered":"How to Set Time, Timezone and Synchronize System Clock Using timedatectl Command"},"content":{"rendered":"<p>The\u00a0<strong>timedatectl<\/strong>\u00a0command is a new utility for\u00a0<strong>RHEL\/CentOS 7<\/strong>\u00a0and\u00a0<strong>Fedora 21+<\/strong>\u00a0based distributions, which comes as a part of\u00a0<strong>systemd<\/strong>\u00a0system and service manager, a replacement for old traditional\u00a0<strong>date<\/strong>\u00a0command used in\u00a0<strong>sysvinit<\/strong>\u00a0daemon based Linux distributions.<\/p>\n<div id=\"attachment_17244\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Time-Date-Timezone-in-Linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17244\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Time-Date-Timezone-in-Linux.png\" alt=\"Set System Time, Date and Timezone in Linux\" width=\"720\" height=\"345\" aria-describedby=\"caption-attachment-17244\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17244\" class=\"wp-caption-text\">Use timedatectl to Set System Time, Date and Timezone in Linux<\/p>\n<\/div>\n<p>The\u00a0<strong>timedatectl<\/strong>\u00a0command allows you to query and change the configuration of the system clock and its settings, you can use this command to set or change the current date, time and timezone or enable automatic system clock\u00a0<a href=\"https:\/\/www.tecmint.com\/install-ntp-server-in-centos\/\" target=\"_blank\" rel=\"noopener\">synchronization with a remote NTP server<\/a>.<\/p>\n<p>In this tutorial, am going to take you through the ways you can manage time on your Linux system by setting the\u00a0<strong>date<\/strong>,\u00a0<strong>time<\/strong>,\u00a0<strong>timezone<\/strong>\u00a0and\u00a0<strong>synchronize time with NTP<\/strong>\u00a0from the terminal using new\u00a0<strong>timedatectl<\/strong>\u00a0command.<\/p>\n<p>It is always a good practice to maintain the correct time on your Linux server or system and it can have the following advantages:<\/p>\n<ol>\n<li>maintain a timely operation of system tasks since most tasks in Linux are controlled by time.<\/li>\n<li>correct time for logging events and other information on the system and many more.<\/li>\n<\/ol>\n<h3>How to Find and Set Local Timezone in Linux<\/h3>\n<p><strong>1.<\/strong>\u00a0To display the current time and date on your system, use the\u00a0<strong>timedatectl<\/strong>\u00a0command from the commandline as follows:<\/p>\n<pre># timedatectl  status\r\n<\/pre>\n<div id=\"attachment_17226\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Check-Time-and-Date.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17226\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Check-Time-and-Date.gif\" alt=\"Check Time and Date\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17226\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17226\" class=\"wp-caption-text\">Check Time and Date<\/p>\n<\/div>\n<p>In the scrrentcast above,\u00a0<strong>RTC<\/strong>\u00a0time: is the hardware clock time.<\/p>\n<p><strong>2.<\/strong>\u00a0The\u00a0<strong>time<\/strong>\u00a0on your Linux system is always managed through the\u00a0<strong>timezone set<\/strong>\u00a0on the system, to view your current timezone, do it as follows:<\/p>\n<pre># timedatectl \r\nOR\r\n# timedatectl | grep Time\r\n<\/pre>\n<div id=\"attachment_17227\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Check-Linux-Time-Zone.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17227\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Check-Linux-Time-Zone.gif\" alt=\"Check Linux Time Zone\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17227\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17227\" class=\"wp-caption-text\">Check Linux Time Zone<\/p>\n<\/div>\n<p><strong>3.<\/strong>\u00a0To view all available timezones, run the command below:<\/p>\n<pre># timedatectl list-timezones\r\n<\/pre>\n<div id=\"attachment_17228\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Linux-List-All-Timezones.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17228\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Linux-List-All-Timezones.gif\" alt=\"List All Timezones in Linux\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17228\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17228\" class=\"wp-caption-text\">List All Timezones in Linux<\/p>\n<\/div>\n<p><strong>4.<\/strong>\u00a0To find the local timezone according to your location, run the following command:<\/p>\n<pre># timedatectl list-timezones |  egrep  -o \u201cAsia\/B.*\u201d\r\n# timedatectl list-timezones |  egrep  -o \u201cEurope\/L.*\u201d\r\n# timedatectl list-timezones |  egrep  -o \u201cAmerica\/N.*\u201d\r\n<\/pre>\n<div id=\"attachment_17230\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Find-Local-Timezone-in-Linux.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17230\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Find-Local-Timezone-in-Linux.gif\" alt=\"Find Local Timezone in Linux\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17230\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17230\" class=\"wp-caption-text\">Find Local Timezone in Linux<\/p>\n<\/div>\n<p><strong>5.<\/strong>\u00a0To set your local timezone in Linux, we will use\u00a0<strong>set-timezone<\/strong>\u00a0switch as shown below.<\/p>\n<pre># timedatectl set-timezone \u201cAsia\/Kolkata\u201d\r\n<\/pre>\n<div id=\"attachment_17231\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Local-Timezone-in-Linux.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17231\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Local-Timezone-in-Linux.gif\" alt=\"Set Local Timezone in Linux\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17231\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17231\" class=\"wp-caption-text\">Set Local Timezone in Linux<\/p>\n<\/div>\n<p>It is always recommended to use and set the coordinated universal time,\u00a0<strong>UTC<\/strong>.<\/p>\n<pre># timedatectl set-timezone UTC\r\n<\/pre>\n<div id=\"attachment_17232\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-UTC-Time-in-Linux.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17232\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-UTC-Time-in-Linux.gif\" alt=\"Set UTC Time in Linux\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17232\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17232\" class=\"wp-caption-text\">Set UTC Time in Linux<\/p>\n<\/div>\n<p>You need to type the correct name timezone other wise you may get errors when changing the timezone, in the following example, the timezone \u201cAsia\/Kalkata\u201d is not correct therefore causing the error.<\/p>\n<div id=\"attachment_17233\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Correct-Timezone-in-Linux.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17233\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Correct-Timezone-in-Linux.gif\" alt=\"Set Correct Timezone in Linux\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17233\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17233\" class=\"wp-caption-text\">Set Correct Timezone in Linux<\/p>\n<\/div>\n<h3>How to Set Time and Date in Linux<\/h3>\n<p><strong>6.<\/strong>\u00a0You can set the date and time on your system, using the timedatectl command as follows:<\/p>\n<h6>Set Time in Linux<\/h6>\n<p>To set time only, we can use\u00a0<strong>set-time<\/strong>\u00a0switch along the format of time in\u00a0<strong>HH:MM:SS<\/strong>\u00a0(Hour, Minute and Seconds).<\/p>\n<pre># timedatectl set-time 15:58:30\r\n<\/pre>\n<div id=\"attachment_17234\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Local-Time-in-Linux.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17234\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Local-Time-in-Linux.gif\" alt=\"Set Local Time in Linux\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17234\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17234\" class=\"wp-caption-text\">Set Local Time in Linux<\/p>\n<\/div>\n<h6>Set Date in Linux<\/h6>\n<p><strong>7.<\/strong>\u00a0To set date only, we can use\u00a0<strong>set-time<\/strong>\u00a0switch along the format of date in\u00a0<strong>YY:MM:DD<\/strong>\u00a0(Year, Month, Day).<\/p>\n<pre># timedatectl set-time 20151120\r\n<\/pre>\n<div id=\"attachment_17235\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Date-in-Linux.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17235\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Date-in-Linux.gif\" alt=\"Set Date in Linux\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17235\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17235\" class=\"wp-caption-text\">Set Date in Linux<\/p>\n<\/div>\n<p><strong>8.<\/strong>\u00a0To set both date and time:<\/p>\n<pre># timedatectl set-time '2015-11-20 16:14:50'\r\n<\/pre>\n<div id=\"attachment_17236\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Date-and-Time-in-Linux.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17236\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Date-and-Time-in-Linux.gif\" alt=\"Set Date and Time in Linux\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17236\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17236\" class=\"wp-caption-text\">Set Date and Time in Linux<\/p>\n<\/div>\n<h3>How to Find and Set Hardware Clock in Linux<\/h3>\n<p><strong>9.<\/strong>\u00a0To set your hardware clock to coordinated universal time,\u00a0<strong>UTC<\/strong>, use the\u00a0<strong>set-local-rtc boolean-value<\/strong>\u00a0option as follows:<\/p>\n<p>First Find out if your hardware clock is set to local timezone:<\/p>\n<pre># timedatectl | grep local\r\n<\/pre>\n<p>Set your hardware clock to local timezone:<\/p>\n<pre># timedatectl set-local-rtc 1\r\n<\/pre>\n<div id=\"attachment_17238\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Hardware-Clock-Timezone.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17238\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Hardware-Clock-Timezone.gif\" alt=\"Set Hardware Clock Timezone\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17238\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17238\" class=\"wp-caption-text\">Set Hardware Clock Timezone<\/p>\n<\/div>\n<p>Set your hardware clock to coordinated universal time (UTC):<\/p>\n<pre># timedatectl set-local-rtc 0\r\n<\/pre>\n<div id=\"attachment_17239\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Hardware-Clock-to-UTC.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-17239\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/11\/Set-Hardware-Clock-to-UTC.gif\" alt=\"Set Hardware Clock to UTC\" width=\"720\" height=\"400\" aria-describedby=\"caption-attachment-17239\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-17239\" class=\"wp-caption-text\">Set Hardware Clock to UTC<\/p>\n<\/div>\n<h3>Synchronizing Linux System Clock with a Remote NTP Server<\/h3>\n<p><strong>NTP<\/strong>\u00a0stands for\u00a0<strong>Network Time Protocol<\/strong>\u00a0is a internet protocol, which is used to synchronize system clock between computers. The\u00a0<strong>timedatectl<\/strong>\u00a0utility enables you to automatically sync your Linux system clock with a remote group of servers using NTP.<\/p>\n<p>Please note that, you must have\u00a0<strong>NTP<\/strong>\u00a0installed on the system to enable automatic time synchronization with NTP servers.<\/p>\n<p>To start automatic time synchronization with remote NTP server, type the following command at the terminal.<\/p>\n<pre># timedatectl set-ntp true\r\n<\/pre>\n<p>To disable NTP time synchronization, type the following command at the terminal.<\/p>\n<pre># timedatectl set-ntp false\r\n<\/pre>\n<h3>Summary<\/h3>\n<p>These are very easy examples described in this tutorial and I hope you will find them helpful for setting various Linux system clocks and timezones. To learn more about this tool, head over to\u00a0<strong>timedatectl<\/strong>\u00a0man page.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/set-time-timezone-and-synchronize-time-using-timedatectl-command\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The\u00a0timedatectl\u00a0command is a new utility for\u00a0RHEL\/CentOS 7\u00a0and\u00a0Fedora 21+\u00a0based distributions, which comes as a part of\u00a0systemd\u00a0system and service manager, a replacement for old traditional\u00a0date\u00a0command used in\u00a0sysvinit\u00a0daemon based Linux distributions. Use timedatectl to Set System Time, Date and Timezone in Linux The\u00a0timedatectl\u00a0command allows you to query and change the configuration of the system clock and its settings, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/01\/how-to-set-time-timezone-and-synchronize-system-clock-using-timedatectl-command\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Set Time, Timezone and Synchronize System Clock Using timedatectl Command&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13187","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13187"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13187\/revisions"}],"predecessor-version":[{"id":13188,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13187\/revisions\/13188"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}