Operating Systems  

How to Change Time in Linux

Introduction

Time zone configuration is a crucial aspect of Linux system administration. Ensuring the correct time zone helps maintain accurate logs, schedules, and server synchronization. If your Linux system is currently set to Eastern Standard Time (EST - UTC-5:00) and you need to change it to Indian Standard Time (IST - UTC+5:30), this guide will walk you through the process.

Step 1. Check the Current Time Zone.

Before making any changes, check your current time zone by running.

timedatectl
Bash

This command will display details like,

Timedatectl

If the time zone is set to America/New_York (EST, -0500) or similar, proceed to update it.

Step 2. List Available Time Zones.

To find the correct format for IST, list available time zones using.

timedatectl list-timezones | grep Asia
Bash

Look for Asia/Kolkata, which represents Indian Standard Time (IST, UTC+5:30).

 Indian Standard Time

Step 3. Change the Time Zone from EST to IST.

To update the time zone, use the following command.

sudo timedatectl set-timezone Asia/Kolkata
Bash

Time Zone

Once done, verify the change by running.

timedatectl
Bash

You should now see,

Time zone: Asia/Kolkata (IST, +0530)
Bash

Done

Step 4. Verify the Time Change.

To confirm that your system now reflects the IST time, run.

date
Bash

The output should display the correct time in IST.

Date

Alternative Method: Manual Symlink (For Older Systems)

If your Linux distribution does not support timedatectl, use this method.

  1. Remove the existing time zone file.
    sudo rm -rf /etc/localtime
    Bash
  2. Create a symbolic link to IST.
    sudo ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
    Bash
  3. Verify the new time zone setting.
    date
    Bash

Step 5. Enable Automatic Time Synchronization (NTP).

To ensure your Linux system always has the correct time, enable NTP synchronization.

sudo timedatectl set-ntp on
Bash

This helps maintain accurate system time by syncing with official time servers.

Common Issues & Troubleshooting

1. Command Not Found: timedatectl

If your system does not recognize the timedatectl command, install systemd utilities.

sudo apt install systemd
Bash

(For Debian-based systems like Ubuntu)

sudo yum install systemd
Bash

(For RHEL-based systems like CentOS)

2. Time Not Updating After Change

Restart the systemd-timesyncd service.

sudo systemctl restart systemd-timesyncd
Bash

Or reboot the system.

sudo reboot
Bash

Conclusion

By following these steps, you can seamlessly convert your Linux system's time zone from EST to IST. Keeping the correct time zone ensures accurate scheduling, logging, and system synchronization.