Change timezone in Linux command line

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

  • Location of the local time file in Linux is /etc/localtime.
  • Timezone files are located in /usr/share/zoninfo/

Now, I change the Linux time zone with Two methods.

Method 1: I will copying 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 making a symbolic linux from /usr/share/zoneinfo/Asia/Ho_Chi_Minh to /etc/localtime as follow below

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

Conclusion

You have change your current timezone You can type date command to verify and you’re done. I hope this is helpful for 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 *

Comment moderation is enabled. Your comment may take some time to appear.

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