Linux 永久设置时间

1,修改Linux时间:date -s '2022-09-12 22:00:00'

这种方式只是临时修改系统时间,当系统重新启动的时候就会还原。

2,hwclock --set --date '2022-09-12 22:00:00'

这是修改硬件的时间 也就是永久性修改Linux的时间

[root@localhost ~]# hwclock --help
BusyBox v1.23.1 (2016-02-23 09:52:57 CST) multi-call binary.

Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-t|--systz] [-l|--localtime] [-u|--utc] [-f|--rtc FILE]

Query and set hardware clock (RTC)

        -r      Show hardware clock time
        -s      Set system time from hardware clock
        -w      Set hardware clock from system time
        -t      Set in-kernel timezone, correct system time
                if hardware clock is in local time
        -u      Assume hardware clock is kept in UTC
        -l      Assume hardware clock is kept in local time
        -f FILE Use specified device (e.g. /dev/rtc2)

步骤:

1.date 查看系统时间

2.hwclock --show 查看硬件的时间 hwclock -r

3.hwclock --set --date '2022-09-12 22:00:00'' 设置硬件时间为22年9月12日22点00分00秒

4.hwclock --hctosys 设置系统时间和硬件时间同步

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

微风◝

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值