我们能为您提供什么帮助?

搜索我们的指南和教程,或浏览下方分类。

How to Change the Time Zone in Ubuntu Using the Terminal

392 次浏览 Markdown

1. Check the Current Time Zone

Start by verifying your server’s current time, date, and time zone:

Code
 
timedatectl

This command displays:

  • Local time

  • Universal time (UTC)

  • Current time zone

  • NTP synchronization status

This helps confirm whether a change is required.

 

2. List All Available Time Zones

Ubuntu includes hundreds of time zones. To view the full list:

Code
 
timedatectl list-timezones

If you want to filter by region (e.g., Asia):

Code
 
timedatectl list-timezones | grep Asia

This makes it easier to find the exact zone you need, such as Asia/Kolkata.

 

3. Set a New Time Zone

Once you identify the correct time zone, apply it using:

Code
 
sudo timedatectl set-timezone Region/City

Examples:

Code
 
sudo timedatectl set-timezone Asia/Kolkata
sudo timedatectl set-timezone America/New_York
sudo timedatectl set-timezone UTC

The change is applied instantly and does not require a reboot.

 

4. Verify the Updated Time Zone

Run the following again to confirm:

Code
 
timedatectl

You should now see the updated time zone reflected in the output.

 

5. Alternative Method (If timedatectl Is Not Available)

Some minimal installations or containers may not include timedatectl. In such cases, you can reconfigure the time zone using:

Code
 
sudo dpkg-reconfigure tzdata

This opens a menu-based interface where you can select your region and city.

 

6. Manual Method (Advanced Users)

You can also manually link the appropriate zoneinfo file:

Code
 
sudo ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

Example:

Code
 
sudo ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

This method is less common but useful in restricted environments.

这对您有帮助吗?

感谢您的反馈!

仍需帮助?

如果上述内容未能解答您的问题,我们的支持团队全天候为您服务。