Linux服务器时间同步

 时间:2026-02-15 09:43:42

1、date命令

使用方式 :

date [-u] [-d datestr] [-s datestr] [--utc] [--universal] [--date=datestr] [--set=datestr] [--help] [--version] [+FORMAT] [MMDDhhmm[[CC]YY][.ss]]

2、1.date :查看当前时间,结果如下:

[root@linuxprobe ~]# date

2016年 04月 29日 星期五 23:04:30 CST

3、2.date '+%Y%M%D' 按照格式显示当前日期,结果如下:

[root@linuxprobe ~]# date "+%Y-%m-%d %H:%M:%S"

2016-04-29 23:30:12

4、3.date -s "xxx xx:xx:xx" 设置系统时间

[root@linuxprobe ~]# date -s "20160429 15:30:00"

2016年 04月 29日 星期五 15:30:00 CST

1、下面我们来看一下我们在复杂环境下怎么把多台linux设置统一的正确环境:对-时间同步命令:utpdate 时间服务器ipntpdate -u xx.xx.xx.xx 结果如下:

Linux服务器时间同步

2、ntp常用服务器:

中国国家授时中心:210.72.145.44

NTP服务器(上海) :ntp.api.bz

美国: time.nist.gov

复旦: ntp.fudan.edu.cn

微软公司授时主机(美国) :time.windows.com

北京邮电大学 : s1a.time.edu.cn

清华大学 : s1b.time.edu.cn

北京大学 : s1c.time.edu.cn

台警大授时中心(台湾):asia.pool.ntp.org

1、查看时区:

1.date "+%Z"

[root@linuxprobe ~]# date "+%Z"

[root@linuxprobe ~]# CST

2.使用cat /etc/sysconfig/clock查看当前时区

Linux服务器时间同步

2、设置时区:

复制相应的时区文件,替换系统默认时区 文件链接法[root@linuxprobe ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime[root@linuxprobe ~]#

Linux服务器时间同步

3、将系统时间写入到硬件(bios)

1.hwclock

[root@linuxprobe ~]# hwclock

2016年04月29日 星期五 15时39分30秒 -0.375972 seconds

2.clock -w

[root@linuxprobe ~]# clock -w

[root@linuxprobe ~]#

  • 远程操作linux系统,卸载ibus输入法
  • gedit报错failed to commit changes..
  • centos7.4的ln命令怎么使用
  • win7如何远程关机
  • VMware连接不上网络
  • 热门搜索
    白粥的做法 阙怎么读音 银耳冰糖雪梨的做法 牛杂火锅的做法 鲍鱼做法大全 排骨炖豆角的做法 冗怎么读 煎饼做法 日记的格式怎么写 卤菜的做法及配方