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系统时间设置(转载)的更多相关文章

  1. Linux 系统时间设置

    from:https://blog.csdn.net/yjh314/article/details/51669238 今早看到一台机器时间对不上,本以为系统时间与网络北京时间不同步,就在终端命令执行网 ...

  2. linux 系统时间 硬件时间

    Linux时钟分为系统时钟(System Clock)和硬件时钟(Real Time Clock,简称RTC).系统时钟是指当前Linux Kernel中的时钟:而硬件时钟则是主板上由电池供电的时钟, ...

  3. Linux系统时间的设置

    1. Linux系统时间的设置 在Linux中设置系统时间,可以用date命令: //查看时间[root@node1 ~]# dateTue Feb 25 20:15:18 CST 2014//修改时 ...

  4. Linux系统时间同步方法

    在Windwos中,系统时间的设置很简单,界面操作,通俗易懂,而且设置后,重启,关机都没关系.系统时间会自动保存在BIOS时钟里面,启动计算机的时候,系统会自动在BIOS里面取硬件时间,以保证时间的不 ...

  5. Linux系统时间同步方法小结

    在Windwos中,系统时间的设置很简单,界面操作,通俗易懂,而且设置后,重启,关机都没关系.系统时间会自动保存在BIOS时钟里面,启动计算机的时候,系统会自动在BIOS里面取硬件时间,以保证时间的不 ...

  6. Linux学习之十-Linux系统时间

    Linux系统时间 1.date命令用于查看以及修改Linux系统的时间,关于date命令的详细帮助文档如下 [root@localhost ~]# date --help Usage: date [ ...

  7. Linux的硬件时间、校正Linux系统时间及系统时间调用流程

    第一部分: 一)概述: 事实上在Linux中有两个时钟系统,分别是系统时间和硬件时间 UTC是协调世界时(Universal Time Coordinated)英文缩写,它比北京时间早8个小时.   ...

  8. 时间篇之linux系统时间和RTC时间

    一.linux系统下包含两个时间:系统时间(刚启动时读取的是rtc时间)和RTC时间. 一般情况下都会选择芯片上最高精度的定时器作为系统时间的定时基准,以避免在系统运行较长时间后出现大的时间偏移.特点 ...

  9. Linux_自动调整linux系统时间和时区与Internet时间同步

    调整linux系统时间和时区与Internet时间同步 一.修改时区:# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime修改为中国的东八区# v ...

随机推荐

  1. ps图层混合模式

    溶解: ------------- 变暗:当使用该模式时,图像中的颜色或物体,总是其中颜色比较深的覆盖比较浅的,而数值相同或更深的像素不受影响.但记住,是上层针对下层,也就是说要有两个图层才有用 正片 ...

  2. Unity3D深入浅出 - 新版粒子系统 (Shuriken) - Tonge

    Shuriken粒子系统是继Unity3.5版本之后推出的新版粒子系统,它采用了模块化管理,个性化的粒子模块配合粒子曲线编辑器使用户更容易创作出各种兵分复杂的粒子效果. 创建一个粒子系统的方式有两种: ...

  3. Python合并两个numpy矩阵

    numpy是Python用来科学计算的一个非常重要的库,numpy主要用来处理一些矩阵对象,可以说numpy让Python有了Matlab的味道. 实际的应用中,矩阵的合并是一个经常发生的操作,如何利 ...

  4. PHP strrpos strpos strstr strrchr 区别

    1. strstr string strstr ( string $haystack , mixed $needle [, bool $before_needle = false ] ) $needl ...

  5. Python_Day_5装饰器、字符串格式化、序列化、内置模块、生成器、迭代器之篇

    一.装饰器 为什么要用装饰器??? 在实际的开发环境中应遵循开发封闭原则,虽然在这个原则是用的面向对象开发,但也适用于函数式编程,简单地说,它规定已经实现的功能代码不是允许修改的,但是可以被扩展: 封 ...

  6. 在EntityFramework中使用 nock的方法。

    以下内容为转载: A:https://dotblogs.com.tw/asdtey/2009/09/27/10793 B:http://www.gitshah.com/2014/08/how-to-a ...

  7. JQuery Pagenation 知识点整理——$.extend(),与$.fn.extend()应用(20150517)

    jQuery为开发插件提拱了两个方法,分别是: jQuery.fn.extend(); jQuery.extend(); 一. $.extend()方法 $.extend()方法在JQuery中有两个 ...

  8. Nokia 的 Scrum标准

    Nokia 的 Scrum标准:• 迭代要有固定时长(被称为“时间盒——timebox”),不能超过六个星期.• 在每一次迭代的结尾,代码都必须经过 QA 的测试,能够正常工作.• Scrum 团队必 ...

  9. pentaho kettle svn

    svn://source.pentaho.org/svnkettleroot/big data : svn://source.pentaho.org/svnkettleroot/archive/pen ...

  10. ORALCE 游标简单的实例

    --取简单的游标 declare cursor sp is select * from user_tables; myrecord user_tables%ROWTYPE; begin open sp ...