Using the correct timezone is essential for many systems related tasks and processes. For example, the CRON daemon uses the system’s timezone for executing CRON jobs, and the timestamps in the log files are based on the same system’s timezone. On Ubuntu, the system’s timezone is set during the install, but it can be easily changed at a later time. This article describes how to set or change the timezone on Ubuntu using the command line, or through the GUI.
Only the root or user with sudo privileges can set or change the system’s timezone.
Checking the Current Timezone
timedatectl is a command-line utility that allows you to view and change the system’s time and date. It is available on all modern systemd-based Linux systems, including Ubuntu 20.04.
To print the current system’s timezone invoke the
timedatectl without any arguments:
The output below shows that the system’s timezone is set to “UTC”:
Local time: Wed 2020-05-06 19:33:20 UTC Universal time: Wed 2020-05-06 19:33:20 UTC RTC time: Wed 2020-05-06 19:33:22 Time zone: UTC (UTC, +0000) System clock synchronized: yes NTP service: active RTC in local TZ: no
The system timezone is configured by symlinking
/etc/localtime to a binary timezone identifier in the
/usr/share/zoneinfo directory. Another option to view the current system’s timezone is find the file to which the symlink points to:
ls -l /etc/localtime
lrwxrwxrwx 1 root root 27 Dec 10 12:59 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC
The system’s timezone in also written to the
Changing the Timezone Using the
Before changing the timezone, you’ll need to find out the long name for the timezone you want to use. The timezones are using “Region/City” format. To list all available time zones, you can either list the files in the
/usr/share/zoneinfo directory or invoke the
timedatectl command with the
... America/Montevideo America/Nassau America/New_York America/Nipigon America/Nome America/Noronha ...
Once you identify which time zone is accurate to your location, run the following command as sudo user:
sudo timedatectl set-timezone your_time_zone
For instance, to change the system’s timezone to
sudo timedatectl set-timezone America/New_York
timedatectl command to verify the changes:
Local time: Wed 2020-05-06 15:41:42 EDT Universal time: Wed 2020-05-06 19:41:42 UTC RTC time: Wed 2020-05-06 19:41:48 Time zone: America/New_York (EDT, -0400) System clock synchronized: yes NTP service: active RTC in local TZ: no
Changing the Timezone Using the GUI
If you are running Ubuntu Desktop, you can change the current system’s timezone through the GUI. Open the system settings window by clicking on the
Settings icon, as shown in the image below:
In the system settings window click on the
Date & Time tab. If the
Automatic Time Zone set to
ON and you have an Internet connection and location service enabled, the time zone should be automatically set according to your location.
To select the new timezone, you can either click on the map or search for a time zone through the search bar. Once done, click on
× to close the window.