Reconfigure Timezone from the Command Line

đź“… October 24, 2016
tzdata2The timezone setting (tzdata) determines how time is displayed on a Linux system. This is specified using a location string, and we can change this string to set a system’s timezone to any timezone on the planet.

The PHP manual provides a List of Supported Timezones to choose from in case you would like to see them. To find the current timezone string used by your Linux system, enter,

cat /etc/timezone

You should see something like this:

a

Timezone string returned in Bash. This string influences how system time is presented.

To change the Linux timezone from the command line, open a terminal and enter,

sudo dpkg-reconfigure tzdata

This opens a full-terminal program where you will select a geographic area followed by a city or region.

a

Select your geographic region here.

Suppose we want to change the timezone from Europe/Amsterdam to London. First, select Europe as the geographic region and choose Ok. A second menu appears.

a

Select a major city closest to your location. You need not reside within the city, but your timezone must share one of the listed cities. Highlight a select, and choose Ok.

Upon exiting, you will see your local time and UTC in the terminal to show the update.

a

Timezone has been changed to Europe/London.

Other system clocks will update also. In Linux Mint 18, the clock applet might take a minute or two before it updates, but we can see an immediate update in Bash using cat /etc/timezone and date.

a

cat /etc/timezone shows the new timezone string, and data presents the time and date using the new timezone setting.

Setting UTC

If you wish to set your Linux system to UTC, run the setup again.

sudo dpkg-reconfigure tzdata
a

For UTC, scroll to the bottom and choose None of the above.

a

Next, choose UTC. Other universal time variants are available, but UTC is probably what you want.

a

The system timezone will now be set to UTC. The timezone string reads Etc/UTC.

, ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: