Change timezone in Linux

In this tutorial, I will change timezone in Linux by command line. How to change the localtime to your current time zone.

  • 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 /usr/share/zoneinfo/Asia/Ho_Chi_Minh to /etc/localtime as following below

$ sudo rm -f /etc/localtime
$ sudo ln -s /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime

Verify the new timezone:

Change timezone in Linux

Conclusion

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.

You have changed your current timezone You can type date command to verify and you’re done. I hope this is helpful to you.

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.