A time zone refers to the local time of a region or a 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 an important thing to set a correct time zone in your system. Many applications are built with time crucial. So it is necessary to set the correct time zone to work the application correctly.

This tutorial will help you to check the current time zone of the system and also set the new time zone on Linux-based systems.

Check Current Timezone

You can view the current time zone of a system by simply typing the ‘date’ command in the terminal.

date 
Output:
Sat Dec 12 18:19:02 UTC 2020

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.

timedatectl 
Output:
Local time: Sat 2020-12-12 18:18:34 UTC Universal time: Sat 2020-12-12 18:18:34 UTC RTC time: Sat 2020-12-12 18:18:33 Time zone: Etc/UTC (UTC, +0000) Network time on: yes NTP synchronized: yes RTC in local TZ: no

Set or Change Time Zone in Linux

The Linux keeps time zone relegated files are available under /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.

  • Method 1 – Using timedatectl command (Recommended)

    Use of timedatectl command is the proffered way to set or change the time zone on a Linux system. You can list all the available timezones with the following command.

    timedatectl list-timezones 
    

    Find out the correct time zone for your system in the above result. Next, use the following command to set a new time zone to the Linux system.

    sudo timedatectl set-timezone "America/Los_Angeles" 
    
  • Method 2 – Using /etc/localtime Symlink

    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 of remove the current file:

    sudo mv /etc/localtime /etc/localtime-old
    

    Then change the symbolic link of file to the correct time zone configuration file:

    sudo 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.

Conclusion

In this tutorial, you have learned about setting or changing the time zone on a Linux system.