For operating systems having the correct time zone is required for system tasks and processes and down to the minor parts such as logs by your applications. Having incorrect information can impact systems when setting up automatic jobs such as cron jobs that rely on the system’s timezone to execute.
In the following tutorial, you will learn how to configure Timezone on Debian 11 Bullseye.
Table of Contents
- Recommended OS: Debian 11 Bullseye
- User account: A user account with sudo privilages or root access (su command).
Updating Operating System
Update your Debian 11 operating system to make sure all existing packages are up to date:
sudo apt update && sudo apt upgrade
Root or Sudo Access
By default, when you create your account at startup with Debian compared to other distributions, it does not automatically receive sudoers status. You must either have access to the root password to use the su command or visit our tutorial on How to Add a User to Sudoers on Debian.
Timezone – Terminal Method
Checking the Current Timezone
First, check to see the current time zone in your Debian terminal by typing the following command:
The timezone by default is configured with a (symlink) from (/etc/localtime) to a binary timezone identifier in the (/usr/share/zoneinfo) directory which you can view the current system timezone information by finding the file where the symlink directs to by typing the following command:
ls -l /etc/localtime
Another way is to use the (cat) command to print the time from the (/etc/timezone) file by typing the command:
Changing the Timezone with (timedatectl) Command
To change the timezone settings in your terminal, you will first need to find the region and city format. To do this, you will use the (timedatectl) command to print this list in (Region/City) Format.
You will find a long list of region/city names, use your (up) and (down) keyboard arrow keys to navigate until you find the timezone you are after.
Once you find the correct entry, you will use (timedatectl) to set the timezone with the following command:
sudo timedatectl set-timezone your_time_zone
For the tutorial, it was set to (Australia/Queensland) using the command:
sudo timedatectl set-timezone Australia/Queensland
Next, check to see the timezone has been applied by re-entering the (timedatectl) command:
Timezone – GUI Method
Debian desktop users have a secondary choice to change the timezone settings graphically instead of using the terminal option. Using the GUI instead can be quicker and easier for new users to Linux and Debian.
First, open the system settings, which the quickest way is by clicking in the top right-hand corner of your Debian desktop screen as shown below and clicking on (settings):
Next, on the left-hand side, scroll down until you find the (Date & Time) tab and left-click on it to show the timezone settings in the right-hand GUI window. This should be automatically set by default if your operating system is connected to the Internet for desktop users.
To select the new timezone, click on the (Time Zone) on the right-hand side, currently were (AEST (Brisbane, Australia) is in our above picture. You will then see a new pop-up with a map, here you use the left click of a mouse button to select your location, which will automatically change your time zone on the map.
The example below from switching to (AWST (Perth, Australia) from (AEST (Brisbane, Australia):
Once you have selected the correct timezone, click on the (X) in the top right-hand corner to apply, and that is it you have successfully changed a time zone using the GUI.
Comments and Conclusion
In the guide, you have learned to set your timezone using the terminal and use the GUI if you have a desktop. Overall, I would suggest that novice and new users try the terminal command as it will be more entertaining to learn a new system command than using the default GUI.