CentOS 7修改系统时间及硬件时间
- 转载于:https://www.cnblogs.com/LouisZJ/p/8554991.html
- [root@nginx ~]# timedatectl --help
- timedatectl [OPTIONS...] COMMAND ...
- Query or change system time and date settings.
- -h --help Show this help message
- --version Show package version
- --no-pager Do not pipe output into a pager
- --no-ask-password Do not prompt for password
- -H --host=[USER@]HOST Operate on remote host
- -M --machine=CONTAINER Operate on local container
- --adjust-system-clock Adjust system clock when changing local RTC mode
- Commands:
- status Show current time settings
- set-time TIME Set system time
- set-timezone ZONE Set system time zone
- list-timezones Show known time zones
- set-local-rtc BOOL Control whether RTC is in local time
- set-ntp BOOL Control whether NTP is enabled
查看当前设置,直接输入timedatectl等同于timedatectl status
- [root@tgcdn-qd-133 /root]# timedatectl \
- Local time: Tue 2018-03-13 10:41:20 CST
- Universal time: Tue 2018-03-13 02:41:20 UTC
- RTC time: Tue 2018-03-13 02:42:29
- Time zone: Asia/Shanghai (CST, +0800)
- NTP enabled: n/a
- NTP synchronized: no
- RTC in local TZ: no
- DST active: n/a
设置当前时间:
- timedatectl set-time HH:MM:SS
设置当前日期:
- timedatectl set-time YYYY-MM-DD
默认的,系统是使用UTC时间的,可以用以下命令打开和关闭UTC时间:
- timedatectl set-local-rtc boolean
把 boolean 替换成yes则表示使用本地时间,替换成no则表示是UTC时间
注:这里的boolean值也可以用true、flase
设置时区:
查看所有的时区:
- timedatectl list-timezones
设置时区
- timedatectl set-timezone time_zone
远程NTP服务器同步
timedatectl还可以设置是否打开NTP选项
- timedatectl set-ntp boolean
这里的boolean是yes或者no
除了以上用法,timedatectl 还支持通过-H参数进行远程主机的时间设置。
查看系统时间
- [root@nginx ~]# date
- 2018年 03月 13日 星期二 10:58:41 CST
查看硬件时间
- [root@nginx ~]# hwclock --show
- 2018年03月13日 星期二 11时00分16秒 -0.086030 秒
假如系统时间和硬件时间都不准确
更新时区
- [root@localhost ~]# timedatectl set-timezone Asia/Shanghai
更新日期
- [root@localhost ~]# timedatectl set-time 2017-06-13
更新时间
- [root@localhost ~]# timedatectl set-time 2017-06-13
将系统时间和硬件时间调整为一致
- [root@localhost ~]# timedatectl set-local-rtc 1
- 或者
- [root@localhost ~]# hwclock --systohc --localtime
将日期写入CMOS
- [root@localhost ~]# clock –w
CentOS 7修改系统时间及硬件时间的更多相关文章
- CentOS 6.9系统时间和硬件时间设置(转)
总结一下hwclock,这个容易晕: 1)/etc/sysconfig/clock 文件,只对 hwclock 命令有效,且只在系统启动和关闭的时候才有用(修改了其中的 UTC=true 到 UTC= ...
- CentOS 永久修改系统时间
1.查看当前系统时间 date 2.修改当前系统时间 date -s "2018-2-22 19:10:30 3.查看硬件时间 hwclock --show ...
- CentOS 系统时间与硬件时间
date 系统时间查看 date -s 'YYYYMMDD HHMMSS' 设置系统时间 hwclock 硬件时间查看 hwclock -w 将系统时间同步到硬件时间 cp /usr/share/zo ...
- Centos7 修改系统时间和硬件时间不一致的问题
查看系统时间 [root@localhost ~]# dateSat Feb 24 14:41:22 CST 2018 查看硬件时间 [root@localhost ~]# hwclock --sho ...
- Linux系统时间和硬件时间设置
在Linux中有硬件时钟与系统时钟两种时钟.硬件时钟是指主机板上的时钟设备,也就是通常可在BIOS画面设定的时钟.系统时钟则是指kernel中的时钟.所有Linux相关指令与函数都是读取系统时钟的设定 ...
- linux 系统文件类型、系统安装时间、系统启动时间、系统运行时间、设置及显示时间、系统时间和硬件时间
系统文件类型: 1) $mout 2) df -l:仅列出本地文件系统:-h (--human-readable):-T:文件系统类型 $df -lhf 3) file -s (--special-f ...
- CentOS7系统时间和硬件时间不同步问题
CentOS7系统中有两个时间:系统时间 和 硬件时间 我们常用命令 date 会输出系统时间,用 date 命令修改的也是系统时间 硬件时间是写入到 BIOS 中的时间,用 hwclock -r 命 ...
- centos 7 修改系统屏幕分辨率
centos 7 修改系统屏幕分辨率,命令方式和图形方式的修改方法. 命令:xrandr 通过命令 xrandr 修改系统的分辨率,输入xrandr: bash [admin@localhost ~] ...
- CentOS设置系统时间、硬件时间、以及定时校对时间
CentOS设置系统时间和时区 一.设置时区 方法一:使用setup工具 setup 选择Timezone configuration 选择Asia/Shanghai 空格键勾选上System clo ...
随机推荐
- sublime text 3 ,React,html元素自动补全方法(用Emmet写法写jsx中的html)
1. 安装emmet: Preferences -> Package Control -> Install Package -> emmet 2. 配置emmet: Preferen ...
- React项目中跨域问题的解决方案
刚刚找到到通过creat-react-app创建的项目中跨域问题的解决方案,记录下来以备后用. 如果接口地址为: http://my.example.com/eg-api 则配置package ...
- oracle数据库连接缓慢
今天连接数据库时非常的慢,大概将近1分钟,才能连上,感觉不对,登录数据库所在的服务器,进行检查,常规的内存.硬盘.CPU全都正常,然后想要进入oracle用户时报错了:su: cannot set u ...
- 2018.5.4 Unix的五种IO模型
阻塞非阻塞和异步同步 同步和异步关注的是消息通信机制,关注两个对象之间的调用关系. 阻塞和非阻塞关注的是程序在等待调用结果(消息,返回值)时的状态,关注单一程序. Unix的五种IO模型 以下基于Li ...
- Python变量和常量
1.什么是变量 变量:核心在于变和量儿字,变->变化,量->状态如何定义? x=1 变量名 变量赋值符号:= 变量值:1 其中变量名又称为标识符: 1. 可以是字母,数字,下划线的任意组合 ...
- STM32的USART应用问题(不定时添加)
ST应用的问题:串口一直在用.不检测会导致一直中断要规避. 规避范例: void USART1_IRQHandler(void) //串口1中断服务程序 { u8 Res; u8 DataCount= ...
- ZJOI2018 D1T2 历史(毕竟我菜,所以题解十分易懂。。)
我定睛一看,上一篇博客居然是去年省选写的...emmm我果然很懒.. 又是一年省选季,临死前订正一下去年的题吧.. 作为第一天30pts的滚粗选手,我去年并没有怎么思考这题.. 题意概括好麻烦,来来来 ...
- 7. Vulnerability exploitation tools (漏洞利用工具 11个)
Metasploit于2004年发布时,将风暴带入了安全世界.它是开发,测试和使用漏洞利用代码的高级开源平台. 可以将有效载荷,编码器,无操作生成器和漏洞利用的可扩展模型集成在一起,使得Metaspl ...
- 第六节《Git克隆》
本节学习如何使用git clone命令建立版本库克隆,以及如何使用git push和gitpull命令实现克隆之间的同步. Git的版本库目录和工作区在一起,因此存在一损俱损的问题,即如果删除一个项目 ...
- HD,3G视频数据中行号的插入方法---Verilog代码实现
HD,3G视频数据中行号的插入方法---Verilog代码实现 行号的生成: `timescale 1ns / 1ps //////////////////////////////////////// ...