ubuntu设置系统时间与网络时间同步和时区
Linux的时间分为System Clock(系统时间)和Real Time Clock (硬件时间,简称RTC)。
系统时间:指当前Linux Kernel中的时间。
硬件时间:主板上有电池供电的时间。
查看系统时间的命令: #date
设置系统时间的命令: #date –set(月/日/年 时:分:秒)
例:#date –set “10/11/10 10:15”
查看硬件时间的命令: # hwclock
设置硬件时间的命令: # hwclock –set –date = (月/日/年 时:分:秒)
上述提到的是手动设置时间到一个时间点,可能与当前网络的时间有误差。下面介绍一下与时间服务器上的时间同步的方法
1. 安装ntpdate工具
# sudo apt-get install ntpdate
2. 设置系统时间与网络时间同步
# ntpdate cn.pool.ntp.org
3. 将系统时间写入硬件时间
# hwclock --systohc
时区修改
1.首先查看时区:
swfsadmin@swfsubuntu:~$ date -R
Tue, 17 Dec 2013 18:23:01 +0800
如果要修改时区,执行sudo tzselect
2.选择区域:亚洲

swfsadmin@swfsubuntu:~$ sudo tzselect
[sudo] password for swfsadmin:
Sorry, try again.
[sudo] password for swfsadmin:
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.选择国家:中国

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.选择时区:北京时间

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.确认验证:

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

改时间参考:
http://5154091.blog.hexun.com/30735220_d.html
修改时间
sudo date -s MM/DD/YY //修改日期
sudo date -s hh:mm:ss //修改时间
在修改时间以后,修改硬件CMOS的时间
sudo hwclock --systohc //非常重要,如果没有这一步的话,后面时间还是不准
http://www.cnblogs.com/php5/archive/2011/02/15/1955432.html
http://os.51cto.com/art/200908/142234.htm
ubuntu设置系统时间与网络时间同步和时区的更多相关文章
- ubuntu设置系统时间与网络时间同步
ubuntu设置系统时间与网络时间同步 Linux的时间分为System Clock(系统时间)和Real Time Clock (硬件时间,简称RTC). 系统时间:指当前Linux Ker ...
- centos7设置系统时间与网络时间同步
Linux的时间分为System Clock(系统时间)和Real Time Clock (硬件时间,简称RTC). 系统时间:指当前Linux Kernel中的时间. 硬件时间:主板上有电池供电的时 ...
- Ubuntu时间有误差,设置系统时间与网络时间同步
转载地址:https://blog.csdn.net/qq_33733970/article/details/78823620
- centos7 设置系统时间与网络同步
1.安装ntpdate工具 yum -y install ntp ntpdate 2.设置系统时间与网络时间同步 ntpdate cn.pool.ntp.org 3.将系统时间写入硬件时间 hwclo ...
- 基于【 centos7】二 || 系统时间与网络时间同步
# date // 查看系统时间 #hwclock // 查看硬件时间 # yum -y install ntp ntpdate 安装ntpdate工具 # ntpdate cn.pool.ntp.o ...
- Linux系统将服务器时间与网络时间同步
遇到一种情景,就是多台服务器之间的时间并不是同步的,有的快有的慢,这时候就要用到网络时间了, 登陆到服务器上,输入命令date可以查询服务器的时间,需要同步的时候需要安装ntpdate; 1. 安装 ...
- Linux的本地时间和网络时间同步
Linux本地时间和网络时间不同步,更新了之后,重启还会变回去.可以通过一下方法修改并保存. 1. 安装ntpdate工具 sudo apt-get install ntpdate 2. 设置系统 ...
- [转] 设置linux时间为网络时间
[From] https://blog.csdn.net/weixin_35852328/article/details/79506453 Linux的时间分为System Clock(系统时间)和R ...
- Linux系统运维笔记(一),查看系统版本和设置系统时间
Linux系统运维笔记 查看系统版本和设置系统时间 查看系统版本 lsb_release -a (适用于所有的linux,包括Redhat.SuSE.Debian等发行版,但是在debian下要安装l ...
随机推荐
- 关于找不到stdafx.h头文件问题
代码: #include "stdafx.h" #include "stdlib.h" char* getcharBuffer() { return " ...
- struct2-json
一.JSON是什么? :JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.易于人阅读和编写,同时也易于机器解 析和生成.它基于JavaScript(Stan ...
- AutoFac初探
.net 4.0使用的DLL #region RegisterType注册 var builder = new ContainerBuilder(); builder.RegisterType< ...
- Python和C#基本算法实现对比
最近在学习python,很多入门的例子又写了一遍,基本上是C#和Python都写了一遍,对比发现语言真是相通啊,只是语法不同而已. python开发也是用的VS,很好用,特别是代码段运行,选中一段py ...
- Spring:启动项目时加载数据库数据(总结)
在项目中需要启动程序时,要将数据库的用户信息表加载到内存中,找到一下几种方式. 1.实现ApplicationListener接口,重写onApplicationEvent方法,可以在项目启动的时候执 ...
- <link>: rel, href
Reference: http://www.w3schools.com/tags/tag_link.asp <link> Attributes: Attribute Value Descr ...
- HTML5 drawImage 使用问题
使用Image遇到的问题: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...
- 设计师如何为 Android 应用标注尺寸
http://blog.cutterman.cn/?p=33 1. 画布大小定位 720 x 1280,72 dpi2. 只使用偶数单位的尺寸,比如 96 px 的列表项高度,16 px 的边距,64 ...
- RemoteViews的理解和使用
一.RemoteViews简介 作用:跨进程更新界面 使用场景:通知栏.桌面小部件 二.在通知栏上的应用 原理:通过RemoteViews加载布局,通过 ...
- 变形课hd1181(DFS)
变形课 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submis ...