ubuntu系统怎么修改时区和时间

本文小编为大家详细介绍“ubuntu系统怎么修改时区和时间”,内容详细,步骤清晰,细节处理妥当,希望这篇“ubuntu系统怎么修改时区和时间”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

网站建设公司,为您提供网站建设,网站制作,网页设计及定制网站建设服务,专注于成都企业网站定制,高端网页制作,对岗亭等多个行业拥有丰富的网站建设经验的网站建设公司。专业网站设计,网站优化推广哪家好,专业网站推广优化,H5建站,响应式网站。

在linux计算机上,有两个时间,一个是硬件时间(bios中记录的时间,称为hwclock),另一个是操作系统时间(osclock)。硬件时钟由bios电池供电,

当计算机关机后,会继续运行,bios电池一般可使用几年,如果没电了,那bios中的数据会恢复出厂设置。

硬件时间与操作系统时间的交互流程

1、开机时,操作系统从bios中读取硬件时间+时区,然后根据osclock的时区,转换为对应的时间。然后操作系统时间与硬件时间就独立运行,相互不影响,我们

通过应用程序获取的时间用的都是操作系统时间。这一步是开机时os自动完成的。

2、主机运行过程中,通过ntp保证osclock与国际原子时同步,再将osclock同步到hwclock。这一步需要自己配置实现

3、关机时,osclock写入hwclock。这一步是关机时os自动完成的。不过我们要考虑异常关机的情况,当异常关机时,osclock可能没有写入hwclock,这就是为什

么在第2步中将osclock定时刷入hwclock的原因。如果不定时刷入,那osclock与hwclock差距比较大时,若异常关机,osclock就丢掉了,再开机时,osclock就是

错误的,在第一个ntp同步到来时,osclock就一直是错误的。而且如果使用的是ntpd,ntpd是渐进调整,要经过多个ntp同步周期后才会将osclock调整为国际原子

时,另外,如果osclock与ntp server的时间差超过1000秒,那ntp server就不会更新osclock了。

ubuntu修改时区和时间的方法

1.首先查看时区:

codetc@webubuntu:~$ date -r
tue, 17 dec 2013 18:23:01 +0800

如果要修改时区,执行sudo tzselect

2.选择区域:亚洲

ubuntu系统怎么修改时区和时间

codetc@webubuntu:~$ sudo tzselect
[sudo] password for codetc: 
please identify a location so that time zone rules can be set correctly.
please select a continent or ocean.
 1) africa
 2) americas
 3) antarctica
 4) arctic ocean
 5) asia
 6) atlantic ocean
 7) australia
 8) europe
 9) indian ocean
10) pacific ocean
11) none - i want to specify the time zone using the posix tz format.
#? 5

3.选择国家:中国

ubuntu系统怎么修改时区和时间

please select a country.
 1) afghanistan      18) israel        35) palestine
 2) armenia        19) japan         36) philippines
 3) azerbaijan      20) jordan        37) qatar
 4) bahrain        21) kazakhstan      38) russia
 5) bangladesh      22) korea (north)     39) saudi arabia
 6) bhutan        23) korea (south)     40) singapore
 7) brunei        24) kuwait        41) sri lanka
 8) cambodia       25) kyrgyzstan      42) syria
 9) china         26) laos         43) taiwan
10) cyprus        27) lebanon        44) tajikistan
11) east timor      28) macau         45) thailand
12) georgia        29) malaysia       46) turkmenistan
13) hong kong       30) mongolia       47) united arab emirates
14) india         31) myanmar (burma)    48) uzbekistan
15) indonesia       32) nepal         49) vietnam
16) iran         33) oman         50) yemen
17) iraq         34) pakistan
#? 9

4.选择时区:北京时间

ubuntu系统怎么修改时区和时间

please select one of the following time zone regions.
1) east china - beijing, guangdong, shanghai, etc.
2) heilongjiang (except mohe), jilin
3) central china - sichuan, yunnan, guangxi, shaanxi, guizhou, etc.
4) most of tibet & xinjiang
5) west tibet & xinjiang
#? 1

5.确认验证:

ubuntu系统怎么修改时区和时间

the following information has been given:
    china
    east china - beijing, guangdong, shanghai, etc.
therefore tz='asia/shanghai' will be used.
local time is now:   tue dec 17 18:22:10 cst 2013.
universal time is now: tue dec 17 10:22:10 utc 2013.
is the above information ok?
1) yes
2) no
#? 1
you can make this change permanent for yourself by appending the line
    tz='asia/shanghai'; export tz
to the file '.profile' in your home directory; then log out and log in again.
here is that tz value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
asia/shanghai

6.复制文件到/etc目录下

sudo cp /usr/share/zoneinfo/asia/shanghai /etc/localtime

7.更新时间

sudo ntpdate time.windows.com

8.修改时间以后,修改硬件cmos的时间

sudo hwclock --systohc

读到这里,这篇“ubuntu系统怎么修改时区和时间”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注创新互联行业资讯频道。


文章标题:ubuntu系统怎么修改时区和时间
网页链接:http://bzwzjz.com/article/ggphdo.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 品牌网站建设 成都网站建设流程 成都网站设计 定制网站建设 企业网站建设公司 LED网站设计方案 重庆网站建设 成都营销网站建设 定制网站制作 重庆外贸网站建设 网站设计 移动网站建设 网站建设费用 成都定制网站建设 网站建设 成都网站制作 成都网站设计 响应式网站设计 网站制作 成都网站设计 成都网站建设 成都商城网站建设