Time Zone or Time Zone is a geographic area that has the same standard time. Usually the timezone is set when linux operating system installation done, but if you forgot to set the timezone during installation, you can still easily change the timezone at a later time.
Using the correct timezone is essential for many system-related tasks and processes. For example, the cron daemon uses the system timezone to execute cron jobs. The time zone is also used for log timestamps.
This tutorial guide covers the steps needed to set or change the time zone on Linux.
Checking the Current Time Zone
timedatectl is a command line utility that allows you to view and change the system time and date. It is available on all Linux systems
To see the current time zone, activate the command
timedatectl without any options or arguments:
Output Local time: Tue 2019-12-03 16:30:44 UTC Universal time: Tue 2019-12-03 16:30:44 UTC RTC time: Tue 2019-12-03 16:30:44 Time zone: Etc/UTC (UTC, +0000) System clock synchronized: no systemd-timesyncd.service active: yes RTC in local TZ: no
The output above shows that the system timezone is set to UTC.
The system time zone is configured by linking files
/etc/localtime to the binary timezone identifier in the directory
Another way to check the timezone is to look at the symlink points path for using the command
$ ls -l /etc/localtime
Output lrwxrwxrwx 1 root root 27 Dec 3 16:29 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC
Changing the Time Zone on Linux
Before changing the time zone, you must know the long name of the timezone you want to use. Timezone naming conventions usually use the format “Region / City”.
To see all available time zones use command
timedatectl or register files in the directory
$ timedatectl list-timezones
Output ... America/Montserrat America/Nassau America/New_York America/Nipigon America/Nome America/Noronha ...
Once you have identified which timezone is accurate for your location, run the following command as root user or sudo → How to Create a Sudo User and a Sudo Group on Ubuntu:
$ sudo timedatectl set-timezone
For example, to change the system timezone to America / New_York you would type:
$ sudo timedatectl set-timezone Asia/Jakarta
To verify changes, re-enable the command
Output Local time: Tue 2019-12-03 13:55:09 EST Universal time: Tue 2019-12-03 18:55:09 UTC RTC time: Tue 2019-12-03 18:02:16 Time zone: Asia/Jakarta (UTC, +7) System clock synchronized: no systemd-timesyncd.service active: yes RTC in local TZ: no
And now it’s done! You have successfully changed your system timezone.
Change Time Zone by Creating Symlink
If you run Linux distro and utility
timedatectl is not in your system you can change the time zone by connecting
/etc/localtime to the timezone in the directory
Remove the current symlink or file:
$ sudo rm -rf /etc/localtime
Identify the timezone you want to configure and symlink:
$ sudo ln -s /usr/share/zoneinfo/Asia/Jakarta /etc/localtime
Verify well by registering files
/etc/localtime or run the date command:
The output includes the timezone, in this example “UTC”.
Output Tue Dec 3 14:10:54 UTC 2019
To change and set the time zone or time zone on Linux systems use the command
sudo timedatectl set-timezone followed by the long name of the time zone you want to set.
And that’s how to set and change the time zone in the time linux operating system You. Hopefully this article is useful and happy learning. 🙂