How to Set or Change Timezone on Debian 11. In this guide you are going to learn how to configure or setup your own timezone on Debian server.
Setting up a correct timezone is necessary on your server for some cronjob or any system related processes. By default, when a server is provisioned a default timezone will be configured automatically with the Coordinated Universal Time (UTC). You can change the timezone later using the below method.
Here you will learn how to use the timedatectl
command to change timezone.
Prerequisites
Access to server using root
or user who has sudo
privileges.
Check Current Timezone
To check the configured time zone that your server uses currently you can use the following command on your Debian 11 machine.
timedatectl
You will get an output similar to the one below.
Output
Local time: Wed 2022-02-16 05:21:35 UTC
Universal time: Wed 2022-02-16 05:21:35 UTC
RTC time: Wed 2022-02-16 05:21:35
Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Now the time zone configured is UTC.
The system timezone is configured by creating a symbolic link of /etc/localtime
to a binary timezone identifier in the /usr/share/zoneinfo
directory.
You can also view the timezone by viewing the timezone
file created inside the etc
directory.
cat /etc/timezone
Output
Etc/UTC
Change Timezone in Debian 11
Now you can proceed to change the default timezone to your location. The time zones in Debian based systems uses the “Region/City” format.
So, you need to find your region and city using the list-timezones
option with the timedatectl
command.
timedatectl list-timezones
This command outputs all the available time zones.
Output
Africa/Abidjan
Africa/Accra
Africa/Algiers
Africa/Bissau
Africa/Cairo
. . .
Press Enter
to load additional available time zones.
Once you have found your time zone you use the below format to setup your own time zone.
sudo timedatectl set-timezone your_time_zone
If your time zone is America/Los_Angeles, your format should be like this
sudo timedatectl set-timezone Australia/Brisbane
Now you can again use the timedatectl
command to confirm the time zone update.
Output
Local time: Wed 2022-02-16 15:24:46 AEST
Universal time: Wed 2022-02-16 05:24:46 UTC
RTC time: Wed 2022-02-16 05:24:46
Time zone: Australia/Brisbane (AEST, +1000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
That’s all.
Prepare yourself for a role working as an Information Technology Professional with Linux operating system
Conclusion
Now you have learned how to change time zone in your Debian 11 machine.
Thanks for your time. If you face any problem or any feedback, please leave a comment below.