How to change TimeZone on CentOS 7 using CLI

Dear friend in this tutorial we will see how to change TimeZone on CentOS 7 server. Suppose CentOS 7 server TimeZone is not according to our requirements and we need to be changed TimeZone on our server. It will very helpful for you. I will see you how to change TimeZone on CentOS 7 server step by step.

For more details about TimeZone you can click on below link:-

https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

We will cover these below topics in this tutorial: –

How to check current TimeZone on our CentOS 7

How to display all available TimeZone on our CentOS 7

How to change current TimeZone on our CentOS 7

How to check current TimeZone on our CentOS 7

We can check our current TimeZone on our CentOS 7 server using this command “timedatectl status

 [[email protected] ~]# timedatectl status
       Local time: Sun 2019-06-09 18:17:57 CEST
   Universal time: Sun 2019-06-09 16:17:57 UTC
         RTC time: Sun 2019-06-09 16:17:57
        Time zone: Europe/Brussels (CEST, +0200)
      NTP enabled: no
 NTP synchronized: no
  RTC in local TZ: no
       DST active: yes
  Last DST change: DST began at
                   Sun 2019-03-31 01:59:59 CET
                   Sun 2019-03-31 03:00:00 CEST
  Next DST change: DST ends (the clock jumps one hour backwards) at
                   Sun 2019-10-27 02:59:59 CEST
                   Sun 2019-10-27 02:00:00 CET
 [[email protected] ~]#

You can see in above out put our current is TimeZone is Europe/Brussels(CEST,+0200)

How to display all available TimeZone on our CentOS 7

You can list all available time zones with the help of “timedatectl list-timezones” like below: –

[[email protected] ~]# timedatectl list-timezones
 Africa/Abidjan
 Africa/Accra
 Africa/Addis_Ababa
 Africa/Algiers
 Africa/Asmara
 Africa/Bamako
 Africa/Bangui
 Africa/Banjul
 Africa/Bissau
 Africa/Blantyre
 Africa/Brazzaville
 Africa/Bujumbura
 Africa/Cairo
 Africa/Casablanca
 Africa/Ceuta
 Africa/Conakry
 Africa/Dakar
 Africa/Dar_es_Salaam
 Africa/Djibouti
 Africa/Douala
 Africa/El_Aaiun
 Africa/Freetown
 Africa/Gaborone
 Africa/Harare
 Africa/Johannesburg
 Africa/Juba
 Africa/Kampala
 Africa/Khartoum
 Africa/Kigali
 Africa/Kinshasa
 Africa/Lagos
 Africa/Libreville
 Africa/Lome
 Africa/Luanda
 Africa/Lubumbashi
 Africa/Lusaka
 Africa/Malabo
 Africa/Maputo
 Africa/Maseru
 Africa/Mbabane
 Africa/Mogadishu
 Africa/Monrovia
 lines 1-42

we can entry on space bar button and we will get all time zones.

Grep command can be used to find out specific time zones. Like below: –

[[email protected] ~]# timedatectl list-timezones | grep -i "Asia/Kol"
Asia/Kolkata
[[email protected] ~]#

How to change current TimeZone on our CentOS 7

Now I am going to change TimeZone on our CentOS 7 server from Europe/Brussels to Asia/Kolkata

[[email protected] ~]# timedatectl set-timezone Asia/Kolkata
[[email protected] ~]#

Now we need to be verified our current TimeZone has been changed or not?

[[email protected] ~]# timedatectl status
      Local time: Sun 2019-06-09 22:09:36 IST
  Universal time: Sun 2019-06-09 16:39:36 UTC
        RTC time: Sun 2019-06-09 16:39:37
       Time zone: Asia/Kolkata (IST, +0530)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
[[email protected] ~]#

You can see in above out put we have successfully changed our CentOS 7 current TimeZone to new TimeZone.

That’s all, in this tutorial we have seen how to change TimeZone on CentOS 7. Thanks for reading and your feedback will be appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *