美文网首页
linux修改时区、系统时间

linux修改时区、系统时间

作者: 缘木与鱼 | 来源:发表于2019-11-07 14:20 被阅读0次

    修改时区

    # 查看时区
    [root@localhost ~]# timedatectl 
    # 修改时区
    [root@localhost ~]# timedatectl set-timezone Asia/Shanghai 
    # 验证
    [root@localhost ~]# timedatectl 
          Local time: Thu 2019-11-07 09:53:18 CST
      Universal time: Thu 2019-11-07 01:53:18 UTC
            RTC time: Thu 2019-11-07 01:53:17
           Time zone: Asia/Shanghai (CST, +0800)
         NTP enabled: yes
    NTP synchronized: yes
     RTC in local TZ: no
          DST active: n/a
    

    修改系统时间

    查看系统时间 date

    [root@localhost ~]# date
    Tue Nov 26 10:29:36 CST 2019
    

    修改日期时间: date -s [yyyy-MM-dd HH:mm:ss]

    # 修改日期,不写时间,会置零
    date -s 2019-11-26
    date -s 2019/11/26
    
    # 修改时间
    date -s 10:29:35
    
    # 修改日期和时间
    date -s '2019-11-26 10:30:00'
    

    将时间写入bios避免重启失效

    hwclock -w
    

    相关文章

      网友评论

          本文标题:linux修改时区、系统时间

          本文链接:https://www.haomeiwen.com/subject/qscvbctx.html