Time zones are a critical part of keeping your system synchronized, especially when dealing with servers or distributed systems across different locations. Linux provides an easy way to check, set, and update the time zone on your workstation or server using the timedatectl command or by creating symbolic links. This guide will walk you through two common methods for configuring your Linux time zone.
Method 1: Setting the Time Zone with timedatectl
Step 1: Check the Current Time Zone
Before changing anything, it’s important to verify the current time zone setting. Run the following command to check the system’s time zone and time status:
#!bash
$ sudo timedatectl
This will output information like the following:
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
Here, you’ll notice details such as the Time zone
, which in this case is set to Etc/UTC
. You can also check if your system clock is synchronized or if the RTC (Real-Time Clock) is set to local time.
Additionally, you can run the following command to confirm where the system is pointing for time zone information:
#!bash
$ sudo ls -l /etc/localtime
For example, the output might be:
#!bash
lrwxrwxrwx 1 root root 27 Dec 3 16:29 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC
This confirms that the system is using the Etc/UTC
time zone.
Step 2: List Available Time Zones
To choose a new time zone, you can list all available time zones by running:
#!bash
sudo timedatectl list-timezones
You’ll see a list similar to this:
America/Montserrat
America/Nassau
America/New_York
America/Nipigon
America/Nome
America/Noronha
etc...
Browse through the list to find the appropriate time zone for your region.
Step 3: Set the New Time Zone
Once you know the desired time zone, you can update the system by using the following command format:
#!bash
sudo timedatectl set-timezone <your_time_zone>
For example, to set the time zone to Asia/Manila, use:
#!bash
sudo timedatectl set-timezone Asia/Manila
Step 4: Verify the Change
After updating the time zone, you can run timedatectl
again to confirm the new settings:
#!bash
sudo timedatectl
The output should now reflect the updated time zone. For example:
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: America/New_York (EST, -0500)
System clock synchronized: no
systemd-timesyncd.service active: yes
RTC in local TZ: no
For more details on using timedatectl
, refer to the official timedatectl Man Page.
Method 2: Changing Time Zone Using Symbolic Links
If for any reason you cannot use timedatectl
, you can manually set the time zone by updating the symbolic link for /etc/localtime
. Follow the steps below.
Step 1: Remove the Existing Time Zone Link
First, remove the current time zone symlink by running:
#!bash
sudo rm -rf /etc/localtime
Step 2: Create a New Symlink for the Desired Time Zone
Next, create a new symlink that points to your desired time zone. For example, to set the time zone to America/New_York
, you would run:
#!bash
sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
Step 3: Verify the Change
To confirm that the time zone has been successfully updated, you can check the date and time by running:
#!bash
date
The output should now display the correct local time based on the new time zone. For example:
Tue Dec 3 14:10:54 EST 2019
Refer to the Linux Man Page for date
for additional options with the date
command.
Additional Resources
For further details on Linux time configuration, refer to the following resources:
- Systemd Time and Date Configuration – Covers options for system time management in systemd-based distributions.
Systemd Time and Date Configuration - Ubuntu Time Zone Configuration – Detailed guide on time zone settings in Ubuntu.
Ubuntu Time Zone Configuration Guide - Red Hat Enterprise Linux 8 System Time Guide – Red Hat documentation covering
timedatectl
and NTP synchronization.
RHEL 8 System Time Guide
Conclusion
Whether you are using a Linux workstation or server, updating the time zone is a straightforward process using either the timedatectl
command or by manually creating a symlink for /etc/localtime
. Keeping your system’s time accurate ensures that logging, scheduling, and other time-sensitive operations run smoothly.
By following the methods outlined in this guide, you can quickly verify, set, or change the time zone on your Linux system.