Linux 修改时区
Posted 遠離塵世の方舟
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux 修改时区相关的知识,希望对你有一定的参考价值。
CentOS 7修改方式如下:
# lsb_release -a --查看系统版本-CentOS Linux release 7.6
# timedatectl --查看当前系统时区
# ls -l /etc/localtime
# timedatectl list-timezones | grep ‘Dubai‘ 或者grep ‘Shanghai‘查看国内时期。这里我要修改为Dubai时间。
Asia/Dubai
# timedatectl set-timezone Asia/Dubai
# ll /etc/localtime
lrwxrwxrwx 1 root root 32 Apr 21 18:58 /etc/localtime -> ../usr/share/zoneinfo/Asia/Dubai
# ls -l /etc/localtime
# timedatectl list-timezones | grep ‘Dubai‘ 或者grep ‘Shanghai‘查看国内时期。这里我要修改为Dubai时间。
Asia/Dubai
# timedatectl set-timezone Asia/Dubai
# ll /etc/localtime
lrwxrwxrwx 1 root root 32 Apr 21 18:58 /etc/localtime -> ../usr/share/zoneinfo/Asia/Dubai
You need to use the ln command to set timezone on Centos 6. Type the following commands as root:
cp /etc/localtime /root/old.timezone
rm /etc/localtime
ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
Verify new settings by typing the following two commands:
date
ls -l /etc/localtime
rm /etc/localtime
ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
Verify new settings by typing the following two commands:
date
ls -l /etc/localtime
以上是关于Linux 修改时区的主要内容,如果未能解决你的问题,请参考以下文章