In this tutorial, I will change timezone in Linux by command line. How to change the
- The location of the local time file in Linux is /etc/localtime.
- Timezone files are located in /usr/share/zoninfo/
To change the timezone in the Linux command line, you can use the methods below, which are available on most modern Linux distributions. Here’s how you can do it:
How to Change Timezone in Linux with Two Methods.
Method 1: I will copy from /usr/share/zoneinfo/Asia/Ho_Chi_Minh to /etc/localtime
$ sudo cp /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime
Method 2: I will delete and make a symbolic Linux from
/Asia/Ho_Chi_Minh to /etc/
$ sudo rm -f /etc/localtime $ sudo ln -s /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime
Verify the new timezone:
After changing the timezone, you may need to restart services or applications that rely on the system time to ensure they reflect the new timezone.