How to Change the Time Zone Through the Command Line
Enter the following command in order to view information about your system’s time and time zone:
ubuntu@ip-:~$ timedatectlYou can also view this information by using the following command:
ubuntu@ip-:~$ ls -l /etc/localtime
We will use this command to list all the time zones of Europe:
ubuntu@ip-:~$ timedatectl list-timezones | grep -i asia
ubuntu@ip-:~$ timedatectl list-timezones | grep -i colombo
First, let us unlink the system time with local time through the following command:
ubuntu@ip-:~$ sudo unlink /etc/localtime
The next step is to use the following command to set a new time zone:
ubuntu@ip-:~$ sudo ln -s /usr/share/zoneinfo/Asia/Colombo /etc/localtime
Check Now
ubuntu@ip-:~$ ls -l /etc/localtime