This tutorial demonstrates how to set or change the timezone on Ubuntu 20.04 LTS from the command line. Although, those instructions can be applied also on Ubuntu 18.04 LTS.
You’ll need to be logged in as a user with sudo privileges in order to change the system’s timezone.
Checking the Current Timezone
– In Ubuntu and most other Linux distributions we can use the
timedatectl command to display and set the current system’s time and timezone.
$ timedatectl Local time: Sat 2020-05-02 18:23:34 EDT Universal time: Sat 2020-05-02 22:23:34 UTC RTC time: Sat 2020-05-02 22:23:34 Time zone: America/Toronto (EDT, -0400) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: yes Last DST change: DST began at Sun 2020-03-08 01:59:59 EST Sun 2020-03-08 03:00:00 EDT Next DST change: DST ends (the clock jumps one hour backwards) at Sun 2020-11-01 01:59:59 EDT Sun 2020-11-01 01:00:00 EST
– Alternatively, you can also check the current system’s timezone by displaying the contents of the
$ cat /etc/timezone Etc/UTC
Method 1./ Changing the Timezone Using the timedatectl Command
01- To list all available time zones, you can either list the files in the
/usr/share/zoneinfo directory or use the
timedatectl command like below:
$ timedatectl list-timezones | grep -i europe ... Europe/London Europe/Luxembourg Europe/Madrid .... Europe/Moscow Europe/Oslo Europe/Paris Europe/Podgorica Europe/Prague Europe/Riga Europe/Rome
02- Once you identify which time zone is accurate to your location, run the following command as
sudo user by indicating the your time zone:
$ sudo timedatectl set-timezone your_time_zone
– In this example, we will change the system’s timezone to
Europe/Rome like below:
$ sudo timedatectl set-timezone Europe/Rome
03- Run the
timedatectl command to verify the changes:
$ timedatectl Local time: Sun 2020-05-03 00:24:19 CEST Universal time: Sat 2020-05-02 22:24:19 UTC RTC time: Sat 2020-05-02 22:24:18 Time zone: Europe/Rome (CEST, +0200) NTP enabled: yes NTP synchronized: no RTC in local TZ: no DST active: yes Last DST change: DST began at Sun 2020-03-29 01:59:59 CET Sun 2020-03-29 03:00:00 CEST Next DST change: DST ends (the clock jumps one hour backwards) at Sun 2020-10-25 02:59:59 CEST Sun 2020-10-25 02:00:00 CET
Method 2./ Changing the Timezone by Creating a Symlink
You can change the timezone by symlinking
/etc/localtime to the timezone file in the
01- Identify the timezone you want to configure and create a symlink:
$ sudo ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
02- Verify the changes either by listing the
/etc/localtime file or issuing the
$ date Sun 3 May 00:18:57 CEST 2020
Your successfully set up or change the timezone on Ubuntu 20.04 LTS from the command line. You might want to check the following guides:
We hope this tutorial was enough Helpful. If you need more information, or have any questions, just comment below and we will be glad to assist you!
THIS IS ALL BIZARRE TO ME.
windows: dos box prompt: time
The current time is: whatever it is
Enter the new time: