Linux系统时间设置(转载)
Linux时钟分为系统时钟(System Clock)和硬件(Real Time Clock,简称RTC)时钟。系统时钟是指当前Linux Kernel中的时钟,而硬件时钟则是主板上由电池供电的时钟,这个硬件时钟可以在BIOS中进行设置。当Linux启动时,硬件时钟会去读取系统时钟的设置,然后系统时钟就会独立于硬件运作。
Linux中的所有命令(包括函数)都是采用的系统时钟设置。在Linux中,用于时钟查看和设置的命令主要有date、hwclock和clock。其中,clock和hwclock用法相近,只用一个就行,只不过clock命令除了支持x86硬件体系外,还支持Alpha硬件体系。 1、date
查看系统时间
# date
设置系统时间
# date --set "02/20/2014 16:50:00" (月/日/年 时:分:秒)
2、hwclock/clock
查看硬件时间
# hwclock --show
或者
# clock --show
设置硬件时间
# hwclock --set --date="07/07/06 10:19" (月/日/年 时:分:秒)
或者
# clock --set --date="07/07/06 10:19" (月/日/年 时:分:秒)
3、硬件时间和系统时间同步
按照前面的说法,重新启动系统,硬件时间会读取系统时间,实现同步,但是在不重新启动的时候,需要用hwclock或clock命令实现同步。
硬件时钟与系统时钟同步:# hwclock --hctosys(hc代表硬件时间,sys代表系统时间)或者# clock --hctosys
系统时钟和硬件时钟同步:# hwclock --systohc或者# clock --systohc
4、时区设置
# tzselect Please identify a location so that time zone rules can be set correctly.Please select a continent or ocean. ) Africa ) Americas ) Antarctica ) Arctic Ocean ) Asia ) Atlantic Ocean ) Australia ) Europe ) Indian Ocean10) Pacific Ocean11) none - I want to specify the time zone using the Posix TZ format.#? 输入5,亚洲 Please select a country. ) Afghanistan ) Israel ) Palestine ) Armenia ) Japan ) Philippines ) Azerbaijan ) Jordan ) Qatar ) Bahrain ) Kazakhstan ) Russia ) Bangladesh ) Korea (North) ) Saudi Arabia ) Bhutan ) Korea (South) ) Singapore ) Brunei ) Kuwait ) Sri Lanka ) Cambodia ) Kyrgyzstan ) Syria ) China ) Laos ) Taiwan10) Cyprus ) Lebanon ) Tajikistan11) East Timor ) Macau ) Thailand12) Georgia ) Malaysia ) Turkmenistan13) Hong Kong ) Mongolia ) United Arab Emirates14) India ) Myanmar (Burma) ) Uzbekistan15) Indonesia ) Nepal ) Vietnam16) Iran ) Oman ) Yemen17) Iraq ) Pakistan#? 输入9,中国 Please select one of the following time zone regions.) east China - Beijing, Guangdong, Shanghai, etc.) Heilongjiang3) central China - Gansu, Guizhou, Sichuan, Yunnan, etc.) Tibet & most of Xinjiang Uyghur5) southwest Xinjiang Uyghur#? 输入1,北京时间 The following information has been given: China east China - Beijing, Guangdong, Shanghai, etc. Therefore TZ="Asia/Shanghai" will be used.Local time is now: Fri Jul :: CST .Universal Time is now: Fri Jul :: UTC .Is the above information OK?) Yes2) No#? 输入1,确认
除了使用tzselect命令修改时区外,还可以修改文件变更时区:
# vi /etc/sysconfig/clock ZONE=Asia/Shanghai(查/usr/share/zoneinfo下面的文件) UTC=false ARC=false # rm /etc/localtime # ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Linux系统时间设置(转载)的更多相关文章
- Linux 系统时间设置
from:https://blog.csdn.net/yjh314/article/details/51669238 今早看到一台机器时间对不上,本以为系统时间与网络北京时间不同步,就在终端命令执行网 ...
- linux 系统时间 硬件时间
Linux时钟分为系统时钟(System Clock)和硬件时钟(Real Time Clock,简称RTC).系统时钟是指当前Linux Kernel中的时钟:而硬件时钟则是主板上由电池供电的时钟, ...
- Linux系统时间的设置
1. Linux系统时间的设置 在Linux中设置系统时间,可以用date命令: //查看时间[root@node1 ~]# dateTue Feb 25 20:15:18 CST 2014//修改时 ...
- Linux系统时间同步方法
在Windwos中,系统时间的设置很简单,界面操作,通俗易懂,而且设置后,重启,关机都没关系.系统时间会自动保存在BIOS时钟里面,启动计算机的时候,系统会自动在BIOS里面取硬件时间,以保证时间的不 ...
- Linux系统时间同步方法小结
在Windwos中,系统时间的设置很简单,界面操作,通俗易懂,而且设置后,重启,关机都没关系.系统时间会自动保存在BIOS时钟里面,启动计算机的时候,系统会自动在BIOS里面取硬件时间,以保证时间的不 ...
- Linux学习之十-Linux系统时间
Linux系统时间 1.date命令用于查看以及修改Linux系统的时间,关于date命令的详细帮助文档如下 [root@localhost ~]# date --help Usage: date [ ...
- Linux的硬件时间、校正Linux系统时间及系统时间调用流程
第一部分: 一)概述: 事实上在Linux中有两个时钟系统,分别是系统时间和硬件时间 UTC是协调世界时(Universal Time Coordinated)英文缩写,它比北京时间早8个小时. ...
- 时间篇之linux系统时间和RTC时间
一.linux系统下包含两个时间:系统时间(刚启动时读取的是rtc时间)和RTC时间. 一般情况下都会选择芯片上最高精度的定时器作为系统时间的定时基准,以避免在系统运行较长时间后出现大的时间偏移.特点 ...
- Linux_自动调整linux系统时间和时区与Internet时间同步
调整linux系统时间和时区与Internet时间同步 一.修改时区:# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime修改为中国的东八区# v ...
随机推荐
- Questions that are independent of programming language. These questions are typically more abstract than other categories.
Questions that are independent of programming language. These questions are typically more abstract ...
- max_input_vars 的影响
一同事,让帮忙解决问题:post了1020条数据,结果只显示250条. 判断可能是php的post设置问题,结果发现php.ini里关于post的设置没有问题. 通过 php://input 得到请求 ...
- python时间处理之datetime
python时间处理之datetime 标签: pythondateimportstringc 2012-09-12 23:21 20910人阅读 评论(0) 收藏 举报 分类: Python系列( ...
- Request.RequestContext.RouteData.Values获取不到参数值
Request.RequestContext.RouteData.Values是获取路由配置中参数的值. 如过路由配置是: public static void RegisterRoutes(Rout ...
- OpenJudge计算概论-单词倒排【把句子内单词的顺序翻转】
/*================================================== 单词倒排 总时间限制: 1000ms 内存限制: 65536kB 描述 编写程序,读入一段英文 ...
- js给定时器调用传递参数
给定时器调用传递参数 无论是window.setTimeout 还是window.setInterval,在使用函数名作为调用句柄时都不 能带参数,而在许多场合必需要带参数,这就需要想方法解决.例如对 ...
- 详尽介绍FireFox about:config
一.什么是about:config about: config: 是Firefox的设置页面,Firefox提供了不少高级设置选项在这里以便让你可以更加详细地控制Firefox的运行方式.官方不推荐 ...
- 手机App开发
/* * 登录:输入 */ public void login(String user, String pwd, TextHttpResponseHandler responsehandler) { ...
- Android 抽屉类SlidingDrawer的使用
比较简单,设置好SlidingDrawer控件的handle和content属性就可以了. android:content="@+id/content" android:ha ...
- android 组合控件接收不到点击事件的问题
android点击事件的传播是有子控件传给父控件,如果子控件处理过了,父控件不再处理,所以要想让组合控件接收点击事件,必须屏蔽子控件的点击事件. 设置组合控件的clickable和focusable属 ...