内容纲要
查看系统时间和时区:
date 查看系统时间 date -R 查看时区
修改时区:
tzselect 修改时区
或
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 上海时间
或
rm /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 上海时间
ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime 洛杉矶时间
修改时钟文件:
/etc/sysconfig/clock
修改为:
ZONE="Asia/Shanghai" UTC=false ARC=false
修改系统时间:
date 查看当前系统时间 yum install -y ntpdate 安装 ntpdate 程序 ntpdate time.windows.com 从互联网更新系统时间
ntpdate cn.pool.ntp.org 从互联网更新系统时间 date 再次查看当前系统时间
如果ntpdate time.windows.com出错了.
lsof -i:123 查看 123 端口使用情况 kill -9 1469 杀死进程 ntpdate time.windows.com 同步时间
同步 BIOS 时钟,强制把系统时间写入 CMOS
clock --show 查看硬件时间 clock -w 强制把系统时间写入 CMOS clock --show 查看硬件时间 reboot 重起机器
重新启动系统,硬件时间会读取系统时间,实现同步;但是在不重新启动的时候,需要用 hwclock 或 clock 命令实现同步。
硬件时钟与系统时钟同步:hwclock --hctosys (hc 代表硬件时间,sys 代表系统时间)或者 clock --hctosys 系统时钟和硬件时钟同步:hwclock --systohc 或者 clock --systohc
让 linux 自动从 time.windows.com 自动同步时间
vi /etc/crontab
加上一句自动同步时间:
00 0 1 * * ntpdate -s time.windows.com --每天凌晨 1 点
* */1 * * * ntpdate -s time.windows.com --每一个小时
* */1 * * * ntpdate -s cn.pool.ntp.org
原文始发于:企业宝 http://www.mpnco.cn/
相关文章
- ThinkPad x13 Gen1傲腾H10重装系统的麻烦(0)
- Win10系统电脑进入安全模式的四种方法,让你轻松应对各种问题(0)
- 使用Jetson_benchmark进行性能测试(0)
- 【Python】修改Windows中 pip 的缓存位置与删除 pip 缓存(1)
- ‘%s=%s’ % (k, v) for k, v in params.items(), ^ SyntaxError: Generator expression must be parent(0)