- Changing Time Zone in Debian 11 / Debian 10
We can do the change timezone in two ways,
- Using /etc/localtime file
- Using timedatectl command
1. Using /etc/localtime File
Check current timezone
date
The /etc/localtime is a link to the original timezone file. Check the symbolic link using the following command.
ls -al /etc/localtime
Output
lrwxrwxrwx 1 root root 32 Oct 8 13:58 /etc/localtime -> ../usr/share/zoneinfo/Asia/Dhaka
The /usr/share/zoneinfo/ directory contains all the timezones.
You can check your zone info. For example, America, Chicago, Los_Angeles, Dhaka etc
ls /usr/share/zoneinfo/America/
Now, create a link with the desired timezone file. America/Chicago
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
Verify the timezone using the date command.
date
That’s All.
2. Using timedatectl command
Check current timezone
date
Use the following command to list all time zones.
timedatectl list-timezones
You can filter the output with the city nearer to you.
timedatectl list-timezones | grep -i Los_Angeles
Set the timezone using the following command.
timedatectl set-timezone America/Los_Angeles
Verify the timezone using the date command.
date
That’s All.