查看/修改Linux時區和時間,更新系統時間

來源:互聯網
上載者:User

一、時區
        1. 查看當前時區
                date -R
        2. 修改設定時區
           方法(1)  tzselect
           方法(2)  僅限於RedHat Linux 和 CentOS
                timeconfig
           方法(3) 適用於Debian
                dpkg-reconfigure tzdata
         3. 複製相應的時區檔案,替換系統時區檔案;或者建立連結檔案cp /usr/share/zoneinfo/$主時區/$次時區 /etc/localtime
             在中國可以使用:
                cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

    二、時間
          1、查看時間和日期

                  date

          2、設定時間和日期
               將系統日期設定成1996年6月10日的命令                   date -s 06/22/96
              
     將系統時間設定成下午1點52分0秒的命令                  date -s 13:52:00

          3. 將目前時間和日期寫入BIOS,避免重啟後失效
                  hwclock -w

    三、定時同步時間(在/etc/crontab中添加)

    * * * * * /usr/sbin/ntpdate 210.72.145.44 > /dev/null 2>&1

 

另外:

1、手動同步:

ntpdate 210.72.145.44  #210.72.145.44西安中科院提供

ntpdate 219.158.14.130 #該地址是北京網通提供

2、同步之後,將時間資訊寫入bios

hwclock -w

3、centos系統,如果沒有ntpdate命令使用yum install ntp更新;

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.