当前位置: 首页 > Linux

Linux查看和修改时区

时间:2023-04-06 23:31:04 Linux

查看时间和时区查看当前时间date1查看时区cat/etc/timezone1修改时区1.修改或设置Linux服务器时区tzselect1RedHatLinux/CentOStimeconfig1Debiandpkg-reconfiguretzdata12.设置环境变量echo"exportTZ='Asia/Shanghai'">>/etc/profilesource/etc/profile123.创建软链接ln-sf/usr/share/zoneinfo/Asia/Shanghai/etc/localtime1使用timedatectl命令timedatectlset-timezoneAsia/Shanghai1硬件时间查看硬件时间hwclock--show1或clock--show1设置硬件timehwclock--set--date="19/03/1221:55"1orclock--set--date="19/03/1221:55"1同步系统和硬件时钟hc代表硬件时间,sys代表系统时间,systohc代表系统时间为基准,同步到硬件时间hwclock--systohc1或clock--systohc参考链接:Linux中查看时区的2种方法