1、使timedatectl
命令
root@debian8204:~# timedatectl
Local time: Tue 2025-08-26 11:11:29 CST
Universal time: Tue 2025-08-26 03:11:29 UTC
RTC time: Tue 2025-08-26 03:11:29
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
2、查/etc/timezone
文件(debian/ubuntu)
root@debian8204:~# cat /etc/timezone
Asia/Shanghai
3、查看软链接文件(通用方法)
root@debian8204:~# ls -l /etc/localtime
lrwxrwxrwx 1 root root 33 Oct 20 2023 /etc/localtime -> /usr/share/zoneinfo/Asia/Shanghai
4、使用date命令
root@debian8204:~# date
Tue Aug 26 11:16:36 AM CST 2025
root@debian8204:~# date +"%Z %z"
CST +0800
(显示时区缩写和UTC偏移量)
常见时区格式:
Asia/Shanghai
(中国标准时间,CST,UTC+8)America/New_York
(美国东部时间,UTC-5/UTC-4)Europe/London
(格林尼治时间,UTC+0/UTC+1)
如果需要修改时区,可以使用:
sudo timedatectl set-timezone Asia/Shanghai