如何在 Ubuntu Linux 中设置或更改时区
时区
[你安装 Ubuntu 时](https://itsfoss.com/install-ubuntu/)，它会要求你设置时区。如果你选择一个错误的时区，或者你移动到世界的一些其它地方，你可以很容易地在以后更改它。


### 如何在 Ubuntu 和其它 Linux 发行版中更改时区


这里有两种方法来更改 Ubuntu 中的时区。你可以使用图形化设置或在终端中使用 `timedatectl` 命令。你也可以直接更改 `/etc/timezone` 文件，但是我不建议这样做。


在这篇初学者教程中，我将向你展示图形化和终端两种方法：


* [通过 GUI 更改 Ubuntu 中的时区](tmp.bHvVztzy6d#change-timezone-gui) （适合桌面用户）
* [通过命令行更改 Ubuntu 中的时区](tmp.bHvVztzy6d#change-timezone-command-line) （桌面和服务器都工作）


![](/data/attachment/album/202002/01/125334je3yljjffwozmof3.png)


#### 方法 1: 通过终端更改 Ubuntu 时区


[Ubuntu](https://ubuntu.com/) 或一些使用 systemd 的其它发行版可以在 Linux 终端中使用 `timedatectl` 命令来设置时区。


你可以使用没有任何参数的 `timedatectl` 命令来检查当前是日期和时区设置：



```
[email protected]:~$ timedatectl
                      Local time: Sat 2020-01-18 17:39:52 IST
                  Universal time: Sat 2020-01-18 12:09:52 UTC
                        RTC time: Sat 2020-01-18 12:09:52
                       Time zone: Asia/Kolkata (IST, +0530)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no
```

正如你在上面的输出中所看，我的系统使用 Asia/Kolkata 。它也告诉我现在比世界时早 5 小时 30 分钟。


为在 Linux 中设置时区，你需要知道准确的时区。你必需使用时区的正确的格式 (时区格式是洲/城市)。


为获取时区列表，使用 `timedatectl` 命令的 `list-timezones` 参数:



```
timedatectl list-timezones
```

它将向你显示大量可用的时区列表。


![Timezones List](/data/attachment/album/202002/01/125336kna4186def9tetzz.jpg)


你可以使用向上箭头和向下箭头或 `PgUp` 和 `PgDown` 键来在页面之间移动。


你也可以 `grep` 输出，并搜索你的时区。例如，假如你正在寻找欧洲的时区，你可以使用：



```
timedatectl list-timezones | grep -i europe
```

比方说，你想设置时区为巴黎。在这里，使用的时区值的 Europe/Paris ：



```
timedatectl set-timezone Europe/Paris
```

它虽然不显示任何成功信息，但是时区会立即更改。你不需要重新启动或注销。


记住，虽然你不需要成为 root 用户并对命令使用 `sudo`，但是你的账户仍然需要拥有管理器权限来更改时区。


你可以使用 [date 命令](https://linuxhandbook.com/date-command/) 来验证更改的时间好时区：



```
[email protected]:~$ date
Sat Jan 18 13:56:26 CET 2020
```

#### 方法 2: 通过 GUI 更改 Ubuntu 时区


按下 `super` 键 (Windows 键) ，并搜索设置：


![Applications Menu Settings](/data/attachment/album/202002/01/125337kth47l7rd6thaddl.jpg)


在左侧边栏中，向下滚动一点，查看详细信息：


![Go to Settings -> Details](/data/attachment/album/202002/01/125338oshbaul9paaah7bb.jpg)


在详细信息中，你将在左侧边栏中找到“日期和时间”。在这里，你应该关闭自动时区选项（如果它已经被启用），然后在时区上单击：


![In Details -> Date & Time, turn off the Automatic Time Zone](/data/attachment/album/202002/01/125339lf2rp7p3f368n3gz.jpg)


当你单击时区时，它将打开一个交互式地图，你可以在你选择的地理位置上单击，关闭窗口。


![Select a timezone](/data/attachment/album/202002/01/125341kntk3rv6n1jh113w.jpg)


在选择新的时区后，除了关闭这个地图后，你不必做任何事情。不需要注销或 [关闭 Ubuntu](https://itsfoss.com/schedule-shutdown-ubuntu/)。


我希望这篇快速教程能帮助你在 Ubuntu 和其它 Linux 发行版中更改时区。如果你有问题或建议，请告诉我。




---


via: <https://itsfoss.com/change-timezone-ubuntu/>


作者：[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[robsean](https://github.com/robsean) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

[When you install Ubuntu](https://itsfoss.com/install-ubuntu/), it asks you to set a timezone. If you chose a wrong timezone or if you have moved to some other part of the world, you can easily change it later.

So, how can you change the timezone on Ubuntu?

## Here's How to change Timezone on Ubuntu and other Linux distributions

There are two ways to change the timezone on Ubuntu. You can use the graphical settings or use the `timedatectl`

command in the terminal.

You may also change the /etc/timezone file directly, but I won’t advise that, unless you want to experiment (and know what you are doing).

I’ll show you both graphical and terminal methods in this tutorial:

**Change timezone on Ubuntu via GUI (suitable for desktop users)****Change timezone on Ubuntu via command line (works for both desktop and servers)**

## Change Ubuntu timezone via GUI

Press the super key (Windows key) and in the Activities Overview, search for Settings:

![Select Settings from Ubuntu Activities Overview](https://itsfoss.com/content/images/2024/01/select-settings-from-overview.png)

Scroll down a little and look for “*Date and Time*” in the left sidebar. Here, you should turn off the Automatic Time Zone option (if it is enabled) and then click on the Time Zone:

![On the “Date and Time” tab on Ubuntu Settings, turn off the “Automatic Timezone” button. Now, click on the Timezone tab](https://itsfoss.com/content/images/2024/01/turn-off-automatic-time-zone-2.png)

When you click the Time Zone, it will open an interactive map, and you can click on the geographical location of your choice or type the city name. Once you have selected the correct timezone, close the window.

![Select a timezone by clicking on the interactive map.](https://itsfoss.com/content/images/2024/01/select-a-timezne-from-map.png)

You don’t have to do anything apart from closing this map after selecting the new timezone. No need to logout or [shutdown Ubuntu](https://itsfoss.com/schedule-shutdown-ubuntu/).

![The timezone is changed to the newly set zone.](https://itsfoss.com/content/images/2024/01/selected-timezone-is-shown-in-settings.png)

## Change Ubuntu timezone via terminal

[Ubuntu](https://ubuntu.com/?ref=itsfoss.com) or [any other distributions using systemd](https://itsfoss.com/check-if-systemd/) can use the timedatectl command to set timezone in Linux terminal.

You can check the current date and timezone setting using timedatectl command:

`timedatectl`


As you can see, in the output above, my system uses Asia/Kolkata. It also tells me that it is 5:30 hours ahead of GMT.

To set a timezone on Linux, you need to know the exact timezone. You must use the correct format of the timezone (which is Continent/City).

To get the timezone list, use the *list-timezones* option of *timedatectl* command:

`timedatectl list-timezones`


It will show you a list of the available time zones.

You can use the up and down arrow or *PgUp *and *PgDown* keys to move between the pages.

You may also use the grep command to search for your timezone. For example, if you are looking for time zones in Europe, you may use:

`timedatectl list-timezones | grep -i europe`


Let’s say you want to set the timezone to Paris. The timezone value to be used here is Europe/Paris:

`timedatectl set-timezone Europe/Paris`


It won’t show any success message, but the timezone is changed instantly. You don’t need to restart or log out.

You can verify the changed time and timezone by using the [date command](https://linuxhandbook.com/date-command/?ref=itsfoss.com):

## Wrapping Up

I hope this quick tutorial helped you to change timezone on Ubuntu and other Linux distributions.

Oh, wait! Do you want to [add multiple time zones on Ubuntu](https://itsfoss.com/add-multiple-time-zones-ubuntu/)? You might want to check our article on that:

[How to Add Multiple Time Zones in UbuntuThis quick tutorial shows the steps for adding additional clocks for multiple time zones in Ubuntu and other distributions using GNOME desktop environment. If you have family members or colleagues in another country or if you live in a country with multiple time zones, keeping a track of the time](https://itsfoss.com/add-multiple-time-zones-ubuntu/)![](https://itsfoss.com/content/images/wordpress/2020/04/multiple-timezone-clocks.jpg)


![](https://itsfoss.com/content/images/wordpress/2020/04/multiple-timezone-clocks.jpg)

You can also explore similar [Ubuntu tips](https://itsfoss.com/tag/ubuntu/) on our site:

[Ubuntu Tips, Tweaks and Tutorials CollectionLove Ubuntu? We do, too. And we cover it extensively. Here, you’ll find lots of tips, tweaks and tutorials on Ubuntu, the most popular distro out there.](https://itsfoss.com/tag/ubuntu/)![](https://itsfoss.com/content/images/2023/06/ubuntu.png)


![](https://itsfoss.com/content/images/2023/06/ubuntu.png)

*💬 Do you have any suggestions on what other types of Ubuntu tips would you like us to cover?*