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 ...
随机推荐
- Apache Druid架构原理与应用场景
为了帮助卖家提高运营水平,卖家管理后台会展示一些访客.订单等趋势和指标数据,如PV,UV,转化率,GMV等: 这些指标的计算依靠前端埋点和订单详情等数据,其特点是数据量大,并有一定的实时性要求. Dr ...
- ThreadPoolExecutor 几个疑惑与解答
任务是否都要先放入队列? 当工作线程数小于核心线程数时,任务是不会经过队列,而是直接创建 Worker 时传入.但是如果工作线程数已经大于核心线程数,则任务是要先放入队列的.实际上只要是被创建的工作线 ...
- 数据分析处理库--Pandas
Pandas库: pandas索引与计算:
- MySQL中MyISAM与InnoDB的主要区别对比
特征 MyISAM InnoDB 聚集索引 否 是 压缩数据 是(仅当使用压缩行格式时才支持压缩MyISAM表.使用压缩行格式和MyISAM的表是只读的.) 是 数据缓存 否 是 加密数据 是(通过加 ...
- 不使用循环或递归判断一个数是否为3的幂(leetcode 326)
326. Power of ThreeGiven an integer, write a function to determine if it is a power of three. Follow ...
- Android IPC机制基础
概要 多进程概念及多进程常见注意事项 IPC基础:Android序列化和Binder 跨进程常见的几种通信方式:Bundle通过Intent传递数据,文件共享,ContentProvider,基于Bi ...
- 使用 requests
基本实例 #利用requests库发送get请求 import requests r = requests.get('http://httpbin.org/get') print(r.text) 利用 ...
- 存在一个足够大的二维数组,每个数组中的值都是整数,使用javascript如何实现按每个数组中的平均值,从大到小排序这个二维数组?
这是牛客网上的一道题~ 题意:对数组排序,顺序是按照数组的平均值,即按照一个元素和平均值相减的绝对值的大小来排序...本例按这个绝对值递增排序 解题思想:先求出这个数组的平均值,如果 a<b,那 ...
- 简易实践的vue自定义tab入门
本文基于vue官方文档,分别为:动态组件 & 异步组件.插槽.进入/离开 & 列表过渡 章节链接描述 要想实现tab动画,首先要了解vue中哪些元素/那些组件适合在那些条件下实现动画效 ...
- JPA、Hibernate框架、通用mapper
JPA是描述对象-关系表的映射关系,将运行期实体对象持久化到数据库中,提出以面向对象方式操作数据库的思想. Hibernate框架核心思想是ORM-实现自动的关系映射.缺点:由于关联操作提出Hql语法 ...