Files
Linux/Docs/Linux更改时间和时区.md
offends cee91802b3
Some checks failed
continuous-integration/drone Build is failing
synchronization
2025-08-25 15:57:40 +08:00

52 lines
717 B
Markdown

> 本文作者:丁辉
# Linux更改时间和时区
**查看时间**
```bash
date -R
```
## 更改系统时间
- 手动更改
```bash
date -s "2024-04-04 04:44:44"
```
- Ntpdate 同步
```bash
# 同步阿里云时间服务器
ntpdate ntp1.aliyun.com
```
> 遇到报错 `the NTP socket is in use, exiting` , 停止 Ntpd 服务解决
>
> ```bash
> systemctl stop ntpd
> ```
## 更改时区
> 示例修改时区到 Asia/Shanghai
- 手动更改
```bash
rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
```
- 使用 Timedatectl 更改
```bash
timedatectl set-timezone Asia/Shanghai
```
- 使用 Tzselect 更改
```bash
tzselect
```