博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux命令-更新系统时间和硬件时间
阅读量:6942 次
发布时间:2019-06-27

本文共 1064 字,大约阅读时间需要 3 分钟。

查看系统时间和时区:

date 查看系统时间 date -R 查看时区

修改时区:

tzselect  修改时区

 或

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 上海时间 或 rm /etc/localtimeln -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=falseARC=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://duinl.baihongyu.com/

你可能感兴趣的文章
对WF工作流异常(Event on interface type for instance id cannot be delivered)的一点总结....
查看>>
目前常用的加密解密算法
查看>>
近期的一点感慨
查看>>
为什么Linux不需要碎片整理?
查看>>
EasyARM i.mx28学习笔记——开箱试用总结
查看>>
ASP怎么解除文件上传200kb限制
查看>>
Xshell选中的同时把内容复制到剪贴板(还可以设置设置文本分隔符)
查看>>
laravel的中间件demo
查看>>
Linux守护进程的编程实现
查看>>
ISCSI工作流程target和initiator
查看>>
Oracle密码过期the password has expired
查看>>
linux grep常用参数
查看>>
button 按钮,结合onclick事件,验证和提交表单
查看>>
<转>python字典排序 关于sort()、reversed()、sorted()
查看>>
java中Token验证
查看>>
医保业务的相关概念
查看>>
【Mac使用系列】【转载】十几个Mac实用工具
查看>>
网易七鱼 Android 高性能日志写入方案
查看>>
微软Visual Studio 2010架构设计功能应用(转)
查看>>
干净的代码是改出来的
查看>>