How to change the time-zone on Debian Linux

The time zone on Debian, like on other Linux distributions, is a system-wide setting that determines the local time for the system and its applications. It is configured by the /etc/localtime file, which is a symbolic link to the appropriate time zone file located in /usr/share/zoneinfo/. By default, during installation, Debian prompts the user to select their time zone, but it can be changed later using commands such as timedatectl, the preferred method on systems using systemd. This setting influences timestamps on files, logs, and system events, and ensures that all operations involving time are accurate according to the specified geographical region.

This guide will show you how to set the Time Zone on Debian.

Set time-zone using timedatectl Command

Check the current time zone:

timedatectl

List all available time zones:

timedatectl list-timezones

You can scroll through the list or use the grep command to filter specific regions, for example:

timedatectl list-timezones | grep -i "America"

Set the new time zone: Replace Region/City with your desired time zone (e.g., America/New_York).

sudo timedatectl set-timezone Region/City

Verify the change:

timedatectl

If timedatectl is not available, you can manually change the time zone by creating a symbolic link:

List available time zones:

ls /usr/share/zoneinfo

Backup the existing local time file:

sudo mv /etc/localtime /etc/localtime.bak

Create a symlink to the desired time zone: Replace Region/City with the appropriate time zone.

sudo ln -s /usr/share/zoneinfo/Region/City /etc/localtime

Verify the change:

date

This should update your system time zone immediately.

Does the timedatectl command set the time zone permanently?

Yes, when you set the time zone using the timedatectl command on Debian (or other Linux distributions that use systemd), the time zone change is permanent.

Here's why:

  • Permanent Changes: The timedatectl set-timezone command updates the /etc/localtime file, which is a symlink pointing to the appropriate file in /usr/share/zoneinfo/. This file is read by the system to determine the correct time zone. Since the change is reflected in this configuration file, it persists across reboots.

  • No Need for Additional Steps: You do not need to perform any additional steps for the change to remain after a reboot. timedatectl handles all the necessary adjustments.

If you want to verify that the change is persistent, you can check the time zone after rebooting your system by running:

timedatectl

This will display the current system time zone, confirming that your setting has been saved.

Share this page:

0 Comment(s)