A time zone refers to the local time of any region or country. Generally, each country uses one time zone but few of the countries share multiple time zones due to their geological areas.
It is always recommended to set a correct time zone on your server during the initial setup. Most of the applications are built to use system time zone and manage their data accordantly. In that situation, your system must have the correct time zone configured.
This tutorial will describe you to How to Change the Time Zone on Ubuntu Linux Systems?
Check Current Timezone
Login to your Ubuntu system via terminal. Then just type the “date” command to view the current date of the system including the active time zone on the Ubuntu system.
Tue Dec 15 14:21:23 IST 2021
The above command shows that this system is running in the UTC timezone.
You can also refer to the “timedatectl” command to view the details output of the current system time, timezone and many other details.
Local time: Tue 2021-12-15 14:21:35 IST Universal time: Tue 2021-12-15 08:51:35 UTC RTC time: Tue 2021-12-15 08:50:17 Time zone: Asia/Kolkata (IST, +0530) Network time on: yes NTP synchronized: yes RTC in local TZ: no
Change Timezone in Ubuntu 20.04
The Ubuntu systems keep time zone configuration files under the “/usr/share/zoneinfo” directory. There you can find all the available time zone.
You can choose one of the below methods to change the Linux system time zone via the command line.
Option 1 – Using timedatectl
Use of timedatectl command is the proffered way to set or change the time zone on a Linux system. First, find all the available timezones on your system.
Search for the required time zone name in the output of above command. Next use one of the following command to set new time zone on your system.
sudo timedatectl set-timezone "Asia/Kolkata"
Below is some more frequently used Timezones examples.
## Set timezone to "America/New_York" sudo timedatectl set-timezone "America/New_York"
## Set timezone to "Europe/London" sudo timedatectl set-timezone "Europe/London"
## Set timezone to "EST" sudo timedatectl set-timezone "EST"
## Set timezone to "UTC" sudo timedatectl set-timezone "UTC"
## Set timezone to "Asia/Kolkata" sudo timedatectl set-timezone "Asia/Kolkata"
Option 2 – Using /etc/localtime
You can also change the system time by changing the symbolic link of /etc/localtime file on Linux systems. You just need to search for the correct time zone files under /usr/share/zoneinfo directory.
First, rename the current file as backup file:
mv /etc/localtime /etc/localtime-backup
Then change the symbolic link of file to the correct time zone configuration file:
ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
The system will automatically adjust the new time based on the new time zone set on the system. You can again run “timedatectl” command to confirm the time zone is updated correctly.
For “timedatectl” command help page use the below command.
For “timedatectl” command manual page use the below command.
That’s it we have successfully learned How to Change Time Zone on Ubuntu Linux. Feel free to use the comment section in case of any query 😎