这篇文章主要介绍“CentOS下怎么快速修改时区”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“CentOS下怎么快速修改时区”文章能帮助大家解决问题。

方法1: timedatectl set-timezone Asia/Shanghai

#timedatectlWarning:IgnoringtheTZvariable.Readingthesystem'stimezonesettingonly.Localtime:Mon2016-11-2101:52:42ESTUniversaltime:Mon2016-11-2106:52:42UTCRTCtime:Mon2016-11-2106:52:42Timezone:America/New_York(EST,-0500)NTPenabled:n/aNTPsynchronized:noRTCinlocalTZ:noDSTactive:noLastDSTchange:DSTendedatSun2016-11-0601:59:59EDTSun2016-11-0601:00:00ESTNextDSTchange:DSTbegins(theclockjumpsonehourforward)atSun2017-03-1201:59:59ESTSun2017-03-1203:00:00EDT

设置时区为CST(东8区)

#timedatectlset-timezoneAsia/ShanghaiWarning:IgnoringtheTZvariable.Readingthesystem'stimezonesettingonly.Localtime:Mon2016-11-2114:52:59CSTUniversaltime:Mon2016-11-2106:52:59UTCRTCtime:Mon2016-11-2106:52:59Timezone:Asia/Shanghai(CST,+0800)NTPenabled:n/aNTPsynchronized:noRTCinlocalTZ:noDSTactive:n/a[root@localhost~]#方法2:TZ环境变量的方式

修改用户目录下的.bash_profile,在文件末尾追加:

TZ='Asia/Shanghai';exportTZ

推出登录后,重新登录,date命令可以查看效果。

关于“CentOS下怎么快速修改时区”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注亿速云行业资讯频道,小编每天都会为大家更新不同的知识点。