ubuntu修改时区和时间的方法

简介:

改时区参考

http://blog.sina.com.cn/s/blog_6c9d65a1010145st.html

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
复制代码
6.复制文件到/etc目录下
sudo cp /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime
7.更新时间
sudo ntpdate time.windows.com

改时间参考:

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


本文转自xwdreamer博客园博客,原文链接:http://www.cnblogs.com/xwdreamer/p/3409947.html,如需转载请自行联系原作者

目录
相关文章
|
5月前
|
Ubuntu Windows
处理ubuntu启动过程中报错error:proc_thermal_add错误的方法
了解以上方法,就像寻找鬼屋出口的吊灯,当初见“error:proc_thermal_add错误”时的恐惧不翼而飞。各位Ubuntu使用者都是勇敢的探险家,遇到的问题无非是丛林中的野兽,尝试、努力和坚持总能找到解决的办法。
142 21
|
5月前
|
存储 运维 Ubuntu
Ubuntu环境下NTP时间同步服务的离线安装方法
以上就是Ubuntu环境下离线安装和配置NTP时间同步服务的全过程。这种有效的操作不仅可为有网络隔离需求的安全重要环境提供参考,同时也能帮助研发、运维人员在同类情况下处理问题。太阳走过万丈高空,而我们通过NTP服务,轻松把握时间,如同手握流沙,控制每一颗时间粒子的行走。
840 23
|
6月前
|
Ubuntu PHP Apache
在Ubuntu系统中为apt的apache2编译PHP 7.1的方法
以上就是在Ubuntu系统中为apt的apache2编译PHP 7.1的方法。希望这个指南能帮助你成功编译PHP 7.1,并在你的Apache服务器上运行PHP应用。
135 28
|
6月前
|
Ubuntu 关系型数据库 MySQL
在Ubuntu系统的Docker上安装MySQL的方法
以上的步骤就是在Ubuntu系统的Docker上安装MySQL的详细方法,希望对你有所帮助!
624 12
|
8月前
|
Ubuntu
Ubuntu下载ISO镜像的方法
步骤 1:访问Ubuntu官方网站 打开浏览器,输入Ubuntu的官方网址:https://cn.ubuntu.com/download/desktop 接着,点击“Ubuntu Desktop”或你需要的Ubuntu版本。
2083 6
|
10月前
|
监控 Ubuntu 安全
debian或Ubuntu中开启ssh允许root远程ssh登录的方法
在Debian或Ubuntu系统中启用root用户的SSH远程登录需要编辑SSH配置文件、设置root密码并重启SSH服务。虽然这可以在某些情况下提供便利,但必须注意安全性,通过使用强密码、限制IP访问、使用SSH密钥认证等方法来保护服务器的安全。
4006 5
|
12月前
|
监控 Ubuntu Linux
视频监控笔记(五):Ubuntu和windows时区同步问题-your clock is behind
这篇文章介绍了如何在Ubuntu和Windows系统中通过设置相同的时区并使用ntp服务来解决时间同步问题。
246 4
视频监控笔记(五):Ubuntu和windows时区同步问题-your clock is behind
|
Ubuntu 应用服务中间件 网络安全
Ubuntu 22.04环境下为Odoo开启80端口的方法
通过以上步骤,你应该能够在Ubuntu 22.04环境下为Odoo开启80端口。访问你的域名时,Nginx会将请求代理到Odoo,允许你通过80端口访问Odoo应用。
435 1
|
存储 Ubuntu Go
在Ubuntu 16.04上安装Go 1.6的方法
在Ubuntu 16.04上安装Go 1.6的方法
171 1
|
监控 Ubuntu Python
代码实现Ubuntu系统参数监控的方法
通过这种方式,你可以方便地对Ubuntu系统的关键参数进行实时监控,对系统性能分析和资源管理具有重要意义。
150 0