How do I change the timezone of my Linode?

Linode Staff

The timestamp from my Linode does not match the local time. How can I check which timezone is being used and update that?

2 Replies

There are several methods to check and update the timezone on your Linode. Just for clarity, I'll be using America/New_York as my example timezone. If you aren't sure of the naming for your timezone, you can find a list with the following command, or on the following URL:

ls /usr/share/zoneinfo/

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

In order to check the current timezone your Linode is using, depending on your operating system, and which method of setting the timezone was used, you can use the following commands:

cat /etc/timezone

ls -l /etc/localtime

printenv | grep TZ

=========================

There are also a few methods for setting the timezone, also depending on your operating system and preference:

sudo dpkg-reconfigure tzdata

echo America/New_York > /etc/timezone

ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

export TZ=America/New_York

Actually, we need to change the time zone of the operating system, not the time of the "Linode". So what works may depend on your operating system. Two of the one-liners by jgreen do not work in the Ubuntu 20.04 operating system.

Under Ubuntu 20.04, the first one-liner given by jgreen (echo America/New_York > /etc/timezone) changed the contents of /etc/timezone as expected, but did not change the time zone indicated by programs such as date, even after Reboot. I did not try the second one-liner (ln -s…). The third one-liner, (export TZ=America/New_York), worked immediately but after a Reboot it reverted to the old time zone.

The following one-liner, which I stole from this article, worked for me in Ubuntu 20.04, both immediately and after reboot:

sudo timedatectl set-timezone America/New_York

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