How to Set or Change Timezone on Debian 10
3 min read
Using the correct timezone is essential for many systems related tasks and processes. For example, the cron daemon uses the system’s timezone for executing cron jobs, and the timestamps in the log files are based on the same system’s timezone.
On Debian, the system’s timezone is set during the install, but it can be easily changed at a later time.
This article covers how to set or change the timezone on Debian 10 Linux.
Checking the Current Timezone
timedatectl is a command-line utility that allows you to view and change the system’s time and date. It is available on all modern systemd-based Linux systems:
The output below shows that the system’s timezone is set to “UTC”:
Local time: Fri 2020-04-03 19:23:29 UTC Universal time: Fri 2020-04-03 19:23:29 UTC RTC time: Fri 2020-04-03 19:23:29 Time zone: UTC (UTC, +0000) System clock synchronized: no NTP service: inactive RTC in local TZ: no
The system timezone is configured by symlinking
/etc/localtime to a binary timezone identifier in the
/usr/share/zoneinfo directory. You can also find the timezone by checking the path the symlink points to, using the
ls -l /etc/localtime
lrwxrwxrwx 1 root root 23 Nov 21 23:44 /etc/localtime -> /usr/share/zoneinfo/UTC
Changing Timezone in Debian
Before changing the timezone, you’ll need to find out the long name for the timezone you want to use. The timezones are using “Region/City” format.
To list all available time zones, you can either list the files in the
/usr/share/zoneinfo directory or invoke the
timedatectl command with the
... America/Monterrey America/Montevideo America/Montserrat America/Nassau America/New_York ...
Once you identify which time zone is accurate to your location, run the following command as root or user with sudo privileges :
sudo timedatectl set-timezone your_time_zone
For example, to change the system’s timezone to
America/Monterrey, you would run:
sudo timedatectl set-timezone America/Monterrey
Verify the change by checking the current system’s timezone with the
Local time: Fri 2020-04-03 13:30:30 CST Universal time: Fri 2020-04-03 19:30:30 UTC RTC time: Fri 2020-04-03 19:30:30 Time zone: America/Monterrey (CST, -0600) System clock synchronized: no NTP service: inactive RTC in local TZ: no
Changing the Timezone by Creating a Symlink
If you are running an older version of Debian and the
timedatectl command is not present on your system, you can change the timezone by symlinking the
/etc/localtime file to the timezone binary in the
Identify the timezone you want to configure, and create a symlink :
sudo ln -sf /usr/share/zoneinfo/America/Monterrey /etc/localtime
Verify the changes either by listing the
/etc/localtime file or issuing the
Fri 03 Apr 2020 01:34:27 PM CST
To change your Debian system’s timezone, run the
sudo timedatectl set-timezone command followed by the long name of the time zone you want to set.
Feel free to leave a comment if you have any questions.