admin 管理员组

文章数量: 1086019


2024年12月25日发(作者:党史网页素材)

Linux操作系统修改时间和修改时区的方法

Linux操作系统修改时间和修改时区的方法

1、查看当前服务器时间直接在终端中执行date命令即可,这

台服务器上的时间就有问题:

[root@landian~]#date==>查看时间

FriMar2401:33:32CST2017[root@landian~]#date-R==>查看时区

Fri,24Mar201701:38:15+0800

2、修改服务器时区的话在终端中执行tzselect即可开始选择

时区,依次是大洲—国家—地区:

[root@landian~]#tzselectPleaseidentifyalocationsothattim

selectacontinentorocean.

5)Asia==>大洲列表

9)China==>国家列表#?9==>选择国家序列号

Pleaseselectoneofthefollowingtimezoneregions.1)BeijingTime=

=>时间列表2)XinjiangTime#?1==>选择时间序列号

Thefollowinginformationhasbeengiven:

China

BeijingTimeIstheaboveinformationOK?1)Yes2)No#?1==>确认修

3、复制相应的时区文件替换掉系统时区文件:

[root@landian~]#cp/usr/share/zoneinfo/Asia/Beijing/etc/l

ocaltimecp:overwrite`/etc/localtime'?yes==>输入yes回车确认

4、查看当前系统日期直接执行date命令即可,如果需要调整

时间则使用date-s命令:

[root@landian~]#date-s03/23/2017==>时间顺序为月份、日期、

年份ThuMar2300:00:00CST2017

5、修改当前系统具体日期也使用date-s命令,顺序为小时、

分钟、秒:

[root@landian~]#date-s16:47:00ThuMar2316:47:00CST2017

6、把时区、日期和具体时间修改之后要保存到BIOS中避免重

启系统时间又恢复了:

[root@landian~]#hwclock-w


本文标签: 时间 修改 时区 命令 系统