在 Ubuntu 系统中,可以通过以下步骤来修改时间戳:
timedatectl
命令查看当前时间设置:
timedatectl status
设置系统时间为指定时间(例如:2023年10月1日 12:00:00):
sudo timedatectl set-time '2023-10-01 12:00:00'
启用 NTP 同步(可选,但推荐):
sudo timedatectl set-ntp true
验证更改:
再次运行 timedatectl status
查看时间是否已更新。
查看当前时间:
date
设置系统时间为指定时间(例如:2023年10月1日 12:00:00):
sudo date -s '2023-10-01 12:00:00'
同步硬件时钟:
sudo hwclock --systohc
验证更改:
再次运行 date
查看时间是否已更新。
通过以上方法,你可以轻松地在 Ubuntu 系统中修改时间戳。