Change my time zone in my Linode

Linode Staff

How do I sync the clock in my Linode to any given time zone?

2 Replies

Changing time zones in Linux distributions tends to be fairly simple.

Each distro has its own method/steps on changing the timezone. Depending on the distro you’re using, it might be best to follow exact steps, as suggested in our guide below:

Getting Started -> Set the Timezone


If you are running a Debian-based distro (Debian, ubuntu, etc), you can change the time zone with the following command:

sudo dpkg-reconfigure tzdata

This command will prompt a dialog in the terminal with a list of geographic areas and cities to choose from. Using the arrow keys, select the geographic area and city that works best for you and press Enter. Once you're back in your terminal, you should see another output stating which timezone was selected and what the “local time” currently is.


Another more “time-consuming” way to change your time zone that works on any distro is as follows:

Type the following command into your terminal but do not press enter.

sudo ln -sf /usr/share/zoneinfo/

Instead press tab and a list of geographic area should appear, looking something like this:

[email protected]:~$ sudo ln -sf /usr/share/zoneinfo/
Africa/            Cuba               GMT+0              Japan              NZ-CHAT            SystemV/
America/           EET                GMT-0              Kwajalein          Pacific/           Turkey
Antarctica/        Egypt              GMT0               leapseconds        Poland             tzdata.zi
Arctic/            Eire               Greenwich          leap-seconds.list  Portugal           UCT
Asia/              EST                Hongkong           Libya              posix/             Universal
Atlantic/          EST5EDT            HST                localtime          posixrules         US/
Australia/         Etc/               Iceland            MET                PRC                UTC
Brazil/            Europe/            Indian/            Mexico/            PST8PDT            WET
Canada/            Factory            Iran               MST                right/             W-SU
CET                GB                 iso3166.tab        MST7MDT            ROC                zone1970.tab
Chile/             GB-Eire            Israel             Navajo             ROK                zone.tab
CST6CDT            GMT                Jamaica            NZ                 Singapore          Zulu

With this list in mind, enter the name of your geographic area after the command mentioned above but still do not press enter. For example (I'll choose America):

sudo ln -sf /usr/share/zoneinfo/America

Press tab and another list of cities should appear (within whatever region you added to the end of the command). From this list of cities, select one and add it to the end of that command.

In my example, I’ll choose New York to get Eastern Time set, as we are based in Philly :). The command now looks like:

sudo ln -sf /usr/share/zoneinfo/America/New_York

Once you’ve got that situated, still do not press enter. Use the space key to add a space then input /etc/localtime. The complete command should looks something like this:

sudo ln -sf /usr/share/zoneinfo/your-geographic-area/your-city /etc/localtime

Press enter once the command looks good to you to run the command. This command will create a symbolic link that points the /etc/localtime file to the timezone file you selected.

To double check your work, enter the date command and all should be good :)

Setting your time zone should also address any issues with time not being accurate within the Linode. If you find you run into that issue, updated/changed your timezone and are still experiencing these issues you can manually sync the clock based on your time zone using the command below:

sudo timedatectl set-ntp true

This command will start and enable systemd-timesyncd. To confirm if the NTP service is active and the clock is synchronized, use the following command to check the status --> timedatectl status. It should show something like this:

$ timedatectl status
...
Time zone: US/Eastern (EST, -0500)
System clock synchronized: yes
NTP service: active
...

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct