This comprehensive Linux guide expects that you run the following commands as root user but if you decide to run the commands as a different user then ensure that the user has
sudo
access and that you precede each of the privileged commands withsudo
A time zone is nothing but a region of the globe that observes a uniform standard time for constitutional, business and cultural purposes. Using the correct timezone is important for many systems related tasks and processes. Sometimes we forgot to set timezone properly for newly installed system or sometimes we need to change timezone of systems for various testing.
Change Timezone On Ubuntu 18.04 LTS And Newer
Before changing the timezone of your system, you should first check the current timezone of your system.
Checking Current Timezone
To check the current timezone of your system, you can run the following command in your terminal
root@codesposts:~$ timedatectl
Local time: Wed 2019-07-24 22:43:42 UTC
Universal time: Wed 2019-07-24 22:43:42 UTC
RTC time: Wed 2019-07-24 22:43:42
Time zone: Etc/UTC (UTC, +0000)
NTP enabled: no
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
Displaying List Of Timezone
To display the list of available timezones, run the following command
[root@codesposts ~]# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
....
..
America/Dawson
America/Dawson_Creek
America/Denver
America/Detroit
America/Dominica
America/Edmonton
America/Eirunepe
America/El_Salvador
America/Fortaleza
America/Glace_Bay
....
..
Pacific/Saipan
Pacific/Tahiti
Pacific/Tarawa
Pacific/Tongatapu
Pacific/Wake
Pacific/Wallis
If you want to display the list of timezone for specific region, you can use the following command
[root@codesposts ~]# timedatectl list-timezones | grep Asia
This command will display all the Asian timezones
Change The Timezone
To change your current timezone in ubuntu 18.04 LTS, you can run the following command
root@codesposts:~$ unlink /etc/localtime
Then run the following command
root@codesposts:~$ ln -s /usr/share/zoneinfo/[Zone/TimeZone] /etc/localtime
Verify Timezone
You can check the current timezone again to verify the new timezone
[root@codesposts ~]# timedatectl list-timezones
Changing Timezone On Ubuntu 16.04 LTS And Older
If you are using any older version of Ubuntu (16.04 or older), you can follow the steps below
Checking The Current Timezone
Before changing the timezone of your system, you should first check the current timezone of your system.
[root@codesposts ~]# date
Wed July 24 17:52:58 EST 2019
Changing Timezone
Follow the commands below to change the timezone
root@codesposts:~$ mv /etc/localtime /etc/localtime.old
Then run this command
root@codesposts:~$ ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
Change “America/New_York” with your desired timezone.
Verify Timezone
You can check the current timezone again to verify the new timezone
[root@codesposts ~]# date