It is always recommended to set a correct time zone on your server during initial setup. Most of applications are build to use system time zone and manage their data accordantly. In that situation your system must have correct time zone configured. This tutorial will describe you to how to set or change time zone on Ubuntu 20.04 Linux systems.
Check Current Timezone
Login to your Ubuntu system and open a terminal (CTRL+ALT+T). Then just type “date” command to view the current date of system including active time zone on Ubuntu system. The above command shows that this system is running in 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.
Change Timezone in Ubuntu 20.04
The Ubuntu systems keeps 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 Linux system time zone via command line.
Option 1 – Using timedatectlUse of timedatectl command is the proffered way to set or change time zone on a Linux system. First find all the available timezones on your system.timedatectl list-timezones Search for the required time zone name in above command. Next use one of the following command to set new time zone on your system.sudo timedatectl set-timezone “America/New_York” 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/localtimeYou 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 of remove the current 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 new time zone set on system. You can again run “timedatectl” command to confirm time zone is updated correctly.
Conclusion
This tutorial helped you to check and change time zone on Ubuntu 20.04 Linux system. Search for the required time zone name in above command. Next use one of the following command to set new time zone on your system. Below is some more frequently used Timezones examples. First rename of remove the current file: Then change the symbolic link of file to the correct time zone configuration file: