Skip to content

Linux time zone (local time)

Configuring Time Zone Zones

Time zone information is generally required during the installation of Linux when the environment is Desktop. Rarely does the user exchange this information later.

But when it comes to virtual servers and cloud computing environments, it is generally necessary to change the time zone zones of these servers.

Choose the zone in /usr/share/zoneinfo

The /usr/share/zoneinfo directory contains the configuration information for the time zone zones. The system’s local zone is determined by a symbolic link from some file in this directory to the /etc/localtime file.

It is common in the /usr/share/zoneinfo directory to find subdirectories containing macro regions of the world or countries with several time zones.

$ ls -l /usr/share/zoneinfo/ <br></br>drwxr-xr-x. 2 root root 4096 Aug 20 2018 Africa <br></br>drwxr-xr-x. You are root root 8192 Aug 20 2018 America <br></br>drwxr-xr-x. 2 root root 187 Aug 20 2018 Antarctica <br></br>drwxr-xr-x. 2 root root 26 Aug 20 2018 Arctic <br></br>drwxr-xr-x. 2 root root 4096 Aug 20 2018 Asia <br></br>drwxr-xr-x. 2 root root 196 Aug 20 2018 Atlantic <br></br>drwxr-xr-x. 2 root root 4096 Aug 20 2018 Australia <br></br>drwxr-xr-x. 2 root root 09 Aug 20 2018 Brazil <br></br>drwxr-xr-x. 2 root root 136 Aug 20 2018 Canada
(...)

And inside each directory are the time zone configuration files:

$ ls -l /usr/share/ZoneInfoBrazil/ <br></br>-rw-r--r--. 3 root root 634 May 9 2018 Acre <br></br>-rw-r--r--. 2 root root 714 May 9 2018 DeNoronha <br></br>-rw-r--r--. 2 root root 2002 May 9 2018 East <br></br>-rw-r--r--. 2 root root 602 May 9 2018 West

How to change the clock to local time

To change the Linux clock to local time, simply create a symbolic link from the chosen zone file to the /etc/localtime file:

$ ln -s /usr/share/zoneInfo/America/Sao_Paulo /etc/localtime

Once this is done, the watch will automatically start complying with the timezone chosen for all users.

Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.

Did you like it?

Share