The Debian system’s timezone set at the time of installation and you can change it easily at later. Sometimes you need to change timezone due to nature of working or any other reason. This guide explains how to set or change timezone on Debian 10 system.
Check Current Timezone
timedatectl command-line utility is same for all Linux distributions and used to get and set system’s timezone easily. Run the below command to get current timezone:
It should display output as below:
Local time: Fri 2020-05-02 10:00:19 UTC Universal time: Fri 2020-05-02 10:00:19 UTC RTC time: Fri 2020-05-02 10:00:19 Time zone: UTC (UTC, +0000) System clock synchronized: no NTP service: inactive RTC in local TZ: no
/etc/localtime is a link to the original timezone file. You can check the symbolic link using the following command:
ls -l /etc/localtime
lrwxrwxrwx 1 root root 01 May 21 10:21 /etc/localtime -> /usr/share/zoneinfo/UTC
Timezone Config Files of Debian
- /usr/share/zoneinfo/ – Timezone name wise files are stored in this directory. For example, the file
/usr/share/zoneinfo/America/New_Yorkrepresents time zone for New York.
- /etc/localtime – This is a symlink to the file localtime located in
Change Timezone in Debian
First, you should know long name for timezone for which you want to set. To get the list of all available timezones run below command:
It will show output like below:
Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers Africa/Asmara Africa/Bamako Africa/Bangui ... ... America/Caracas America/Cayenne America/Cayman America/Chicago America/Chihuahua America/Costa_Rica ... ... Pacific/Saipan Pacific/Tahiti Pacific/Tarawa Pacific/Tongatapu Pacific/Wake Pacific/Wallis UTC
Choose long name of timezone for your location, run the following command as root or user with sudo privileges.
The syntax for command is:
sudo timedatectl set-timezone NEW_TIME_ZONE
For example, to change timezone to
America/New_York run command as below:
sudo timedatectl set-timezone America/New_York
Now, verify timezone again using
It should changed with new timezone
Local time: Fri 2020-05-02 06:10:49 UTC Universal time: Fri 2020-05-02 10:10:49 UTC RTC time: Fri 2020-05-02 10:10:49 Time zone: America/New_York (EDT, -0400) System clock synchronized: no NTP service: inactive RTC in local TZ: no
Change Timezone By Symlink
Alternate way to change timezone is by creating a symlink. This method is useful when your server is running older version of Debian or not have timedatectl command is available. We are going to change the timezone by creating symlink
/etc/localtime to the timezone in the
Determine timezone, which you want to set and create a symlink, type:
sudo ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
To verify changes, list the
/etc/localtime file or run the date command:
Tue May 02 06:37:22 EDT 2020
It should show new changed date and time with new timezone.
Finally, you have learned how to change timezone in Debian 10.
Feel free to leave comment if you have any questions.