ubuntu在命令行下同步时间

1. 修改 /etc/timezone的时钟为UTC时钟.

echo "Asia/Shanghai" > /etc/timezone

2.修改时区

$sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

3.同步时钟服务器

$sudo ntpdate cn.pool.ntp.org

  报错 21 Feb 03:04:30 ntpdate[19759]: the NTP socket is in use, exiting 解决方法,停止npdd服务

/etc/init.d/ntpd stop

4.写入BIOS

$sudo hwclock --systohc

https://blog.csdn.net/wfing/article/details/9213181

https://blog.51cto.com/upgirl/1136844?_t=t