- Show all Docs ( 5 ) Collapse Docs
- Show all Docs ( 309 ) Collapse Docs
- Show all Docs ( 1 ) Collapse Docs
- Show all Docs ( 31 ) Collapse Docs
How To Set or Change Timezone on Ubuntu 20.04
For many system-related tasks and processes, it is important to use the right time zone. For example, the cron daemon uses the timezone of the system to run cron jobs, and the timestamps in the log files are also based on the timezone of the system.
On Ubuntu, the time zone is set when the system is installed, but it is easy to change it later.
- A ubuntu server
- A Super user ( root ) or any normal user with SUDO privileges.
What is current timezone ?
The command-line programme timedatectl lets you see and change the system's time and date. It can be used on all modern Linux systems that use systemd, such as Ubuntu 20.04.
Run timedatectl with no arguments to see what time zone the system is in:
/etc/localtime is linked to a binary timezone identifier in the /usr/share/zoneinfo directory, which sets the system's timezone.
You can also find the file that the symlink points to to see the current system's time zone:
# ls -l /etc/localtime
lrwxrwxrwx 1 root root 33 May 10 2020 /etc/localtime -> /usr/share/zoneinfo/Europe/Berlin
In the /etc/timezone file, the timezone of the system is also written:
# cat /etc/timezone
Changing the time zone using the timedatectl command
You'll need to know the long name of the time zone you want to use before you can change it. "Region/City" is the format for the time zones.
You can either list the files in the /usr/share/zoneinfo directory or use the timedatectl command with the list-timezones option
# timedatectl list-timezones
Once you know the correct time zone for where you are, run the following command as the
# timedatectl set-timezone Asia/Kolkata
Now again run the timedatectl command to ensure the changes.