查看系统时间和时区:

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 - 1469 杀死进程
ntpdate time.windows.com 同步时间

查看linux lsof详解

同步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

Linux命令-更新系统时间和硬件时间的更多相关文章

  1. Linux命令更新系统时间,更新所有文件的时间(转)

    https://blog.csdn.net/ccj2020/article/details/76026606

  2. linux 系统文件类型、系统安装时间、系统启动时间、系统运行时间、设置及显示时间、系统时间和硬件时间

    系统文件类型: 1) $mout 2) df -l:仅列出本地文件系统:-h (--human-readable):-T:文件系统类型 $df -lhf 3) file -s (--special-f ...

  3. Linux系统时间和硬件时间设置

    在Linux中有硬件时钟与系统时钟两种时钟.硬件时钟是指主机板上的时钟设备,也就是通常可在BIOS画面设定的时钟.系统时钟则是指kernel中的时钟.所有Linux相关指令与函数都是读取系统时钟的设定 ...

  4. CentOS 6.9系统时间和硬件时间设置(转)

    总结一下hwclock,这个容易晕: 1)/etc/sysconfig/clock 文件,只对 hwclock 命令有效,且只在系统启动和关闭的时候才有用(修改了其中的 UTC=true 到 UTC= ...

  5. CentOS 7修改系统时间及硬件时间

    转载于:https://www.cnblogs.com/LouisZJ/p/8554991.html [root@nginx ~]# timedatectl --help timedatectl [O ...

  6. Centos7 修改系统时间和硬件时间不一致的问题

    查看系统时间 [root@localhost ~]# dateSat Feb 24 14:41:22 CST 2018 查看硬件时间 [root@localhost ~]# hwclock --sho ...

  7. CentOS7系统时间和硬件时间不同步问题

    CentOS7系统中有两个时间:系统时间 和 硬件时间 我们常用命令 date 会输出系统时间,用 date 命令修改的也是系统时间 硬件时间是写入到 BIOS 中的时间,用 hwclock -r 命 ...

  8. CentOS 系统时间与硬件时间

    date 系统时间查看 date -s 'YYYYMMDD HHMMSS' 设置系统时间 hwclock 硬件时间查看 hwclock -w 将系统时间同步到硬件时间 cp /usr/share/zo ...

  9. Linux 系统时间和硬件时间

    linux 的系统时间有时跟硬件时间是不同步的 Linux时钟分为系统时钟(System Clock)和硬件(Real Time Clock,简称RTC)时钟.系统时钟是指当前Linux Kernel ...

随机推荐

  1. Java实现-2016百度秋招(颜色反转、相似字符串)

    1.颜色反转 题目描述: 在 Web 开发中,通常使用 16 进制 RGB 表示一个颜色.例 如 #0000FF 表示蓝色,#FF7F50 表示珊瑚红.在这道题中,我们要求把给定的一种颜色取反,方法是 ...

  2. jsoup-1.7.2.jar 包

    org.jsoup.Jsoup; org.jsoup.nodes.Document; org.jsoup.nodes.Element; org.jsoup.select.Elements;

  3. Asp.Net Session的三种方法及Web.Config设置

    转载:http://user.gw-ec.com/login/safelog/redirectt?session=so%2f%2bSjyZURMOe54xgk%2bUhL2CgGqDjOKEbYwZS ...

  4. /etc/fstab格式的问题

    [root@localhost etc]# cat fstab /dev/VolGroup00/LogVol00 /                       ext3    defaults    ...

  5. C语言跟内存分配方式-alloc malloc calloc

    转载:http://blog.csdn.net/ubuntulover/article/details/7581317 (1) 从静态存储区域分配.内存在程序编译的时候就已经分配好,这块内存在程序的整 ...

  6. unity 3D + Google Play In-app Billing (IAB)(转) 热度 3

    最近由于工作需要,研究unity如何接入Google Play以实现游戏内购买.目前IAB的实现,prime31做的插件比较好,各平台的IAB均有,但费用相对过高(几乎都是70刀左右,可怜穷小子).在 ...

  7. 用C#调用Windows API向指定窗口发送按键消息 z

    用C#调用Windows API向指定窗口发送 一.调用Windows API. C#下调用Windows API方法如下: 1.引入命名空间:using System.Runtime.Interop ...

  8. mysql 中 unix_timestamp和from_unixtime函数

    1.unix_timestamp 将时间转化为时间戳.(date 类型数据转换成 timestamp 形式整数) 没传时间参数则取当前时间的时间戳 mysql> select unix_time ...

  9. jQuery EasyUI 数据网格 - 条件设置行背景颜色

    $('#tt').datagrid({ rowStyler:function(index,row){ if (row.listprice>50){ return 'color:blue;font ...

  10. Django的restful api三方包:djangorestframework

    文档位置:https://www.django-rest-framework.org/ 代码位置:https://github.com/encode/django-rest-framework/tre ...