How To Set Or Change The Timezone On Ubuntu

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 with sudo

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

The post How To Set Or Change The Timezone On Ubuntu appeared first on CODESPOSTS.COM.

Go to Source
Author: staff

Ubuntu Server Admin

Recent Posts

How to Fix VMware’s “Could not open /dev/vmmon” Error on Ubuntu

You’ve recently installed VMware Workstation on your Ubuntu system and encountered the frustrating “Could not…

4 hours ago

How to Fix Ubuntu 404 Errors While Fetching Dependencies

Have you ever found yourself staring at a terminal full of 404 errors while trying…

4 hours ago

How to Fix ‘Please Install All Available Updates’ Error When Upgrading Ubuntu 18.04 to 20.04 LTS

One particularly frustrating error that many users face when trying to upgrade from Ubuntu 18.04 …

4 hours ago

How to fix “Release is not valid yet” Error in Docker Containers

In the world of containerization, time synchronization issues can create unexpected roadblocks when working with…

4 hours ago

How to fix “Externally Managed Environment” Pip Errors on Ubuntu

If you’ve recently upgraded to Ubuntu 23.04 or newer, you might have encountered a frustrating…

4 hours ago

Ubuntu now officially supports NVIDIA Jetson: powering the future of AI at the edge

Canonical announces the General Availability of Ubuntu for the NVIDIA® Jetson Orin™ for edge AI…

11 hours ago