Change Timezone in Ubuntu

PowerADM.com / Linux / Ubuntu / Change Timezone in Ubuntu

In this article, we’ll show you how to set the timezone from the Ubuntu command line.

Get the current time and timezone settings:

$ sudo timedatectl

In this example, the following time zone is configured on the computer:

Time zone: America/Chicago (CST, -0600)

timedatectl - check timezone in ununtu

In most Linux distributions, the time zone is set using a symbolic link from the /etc/localtime file to a time zone file in the /usr/share/zoneinfo directory.

You can list all available timezones:

$ sudo timedatectl list-timezones

You can find the timezone you need with grep

$ sudo timedatectl list-timezones | grep Europe

timedatectl list-timezones

To change the time zone, run the command:

$ sudo timedatectl set-timezone Europe/Berlin

This command also changes the current time zone in the /etc/timezone file.

$ cat /etc/timezone

Make sure that the new time zone is now set on Ubuntu:

$ sudo timedatectl

Or:

$ ls -l /etc/localtime

The command output shows that /etc/localtime points to /usr/share/zoneinfo/Europe/Berlin.

/etc/localtime symbolic link

You can also use the pseudo-GUI tzdata or tzselect commands in the Linux console to change the time zone:

$ sudo dpkg-reconfigure tzdata

dpkg-reconfigure tzdata

After changing the time zone, you must restart the cron. Otherwise, your jobs will be scheduled to run in the context of the previously used time zone.

$ sudo /etc/init.d/cron stop
$ sudo /etc/init.d/cron start

Leave a Reply

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