How to Change Timezone on Linux

Changing the timezone on Linux is easy. The timezone within Linux is set by a symbolic link located in the /etc directory which needs to be changed to the new timezone. Once this is changed the time needs to be synced to a time server. I recently moved from Las Vegas to Louisville and had not changed a Linux server to the new timezone. Follow the steps below and the new timezone will be set and updated.

  1. Backup Current Timezone: Issue the below command on your server to backup the current timezone information just in case there are issues.

    1. cp -p /etc/localtime /etc/localtime.bak
  2. Select New Timezone: First choose from the list of timezones located in /usr/share/zoneinfo. Below are examples of what the categories of zones followed by the details of what the America directory looks like.

    1. [root@server ~]# ls /usr/share/zoneinfo/
    2. Africa Asia Canada Cuba EST Factory GMT0 Hongkong Iran Japan Mexico Navajo Poland PRC ROK Universal W-SU
    3. America Atlantic CET EET EST5EDT GB GMT-0 HST Kwajalein Mideast NZ Portugal PST8PDT Singapore US
    4. Antarctica Australia Chile Egypt Etc GB-Eire GMT+0 Iceland Israel Libya MST NZ-CHAT posix right Turkey UTC Zulu
    5. Arctic Brazil CST6CDT Eire Europe GMT Greenwich Indian Jamaica MET MST7MDT Pacific posixrules ROC UCT WET
    6. [root@server ~]# ls /usr/share/zoneinfo/America/
    7. Adak Barbados Caracas Danmarkshavn Fort_Wayne Havana La_Paz Menominee Nipigon Porto_Velho Sao_Paulo Thule
    8. Anchorage Belem Catamarca Dawson Glace_Bay Hermosillo Lima Merida Nome Puerto_Rico Scoresbysund Thunder_Bay
    9. Anguilla Belize Cayenne Dawson_Creek Godthab Indiana Los_Angeles Mexico_City Noronha Rainy_River Shiprock Tijuana
    10. Antigua Blanc-Sablon Cayman Denver Goose_Bay Indianapolis Louisville Miquelon North_Dakota Rankin_Inlet St_Barthelemy Toronto
    11. Araguaina Boa_Vista Chicago Detroit Grand_Turk Inuvik Maceio Moncton Panama Recife St_Johns Tortola
    12. Argentina Bogota Chihuahua Dominica Grenada Iqaluit Managua Monterrey Pangnirtung Regina St_Kitts Vancouver
    13. Aruba Boise Coral_Harbour Edmonton Guadeloupe Jamaica Manaus Montevideo Paramaribo Resolute St_Lucia Virgin
    14. Asuncion Buenos_Aires Cordoba Eirunepe Guatemala Jujuy Marigot Montreal Phoenix Rio_Branco St_Thomas Whitehorse
    15. Atikokan Cambridge_Bay Costa_Rica El_Salvador Guayaquil Juneau Martinique Montserrat Port-au-Prince Rosario St_Vincent Winnipeg
    16. Atka Campo_Grande Cuiaba EnsenadaGuyana Kentucky Mazatlan Nassau Porto_Acre Santiago Swift_Current Yakutat
    17. Bahia Cancun Curacao Fortaleza Halifax Knox_IN Mendoza New_York Port_of_Spain Santo_Domingo Tegucigalpa Yellowknife
  3. Link New Timezone: Now use the below command to link /etc/localtime to the proper timezone. In the example used we link the Louisville timezone from America which is EST.

    1. ln -sf /usr/share/zoneinfo/America/Louisville /etc/localtime
  4. Set Time from Time Server: This command will set the time on your server according to UTC offset by the timezone you have chosen.

    1. rdate -s
  5. Verify New Time: Now issue the below command to verify the new time has been accepted.

    1. [root@server ~]# date
    2. Mon Jan 20 05:19:04 EST 2009

That is all you have to do. The new timezone will be used from now on when the server reboots and when you update the time on the server using rdate.