Linux change date time

maojinyu發表於2010-09-04

Linux修改時間的方法
修改linux的時間可以使用date指令

在命令列輸入:

date
顯示當前時間 Fri Aug 3 14:15:16 CST 2007

date -s
按字串方式修改時間
可以只修改日期,不修改時間,輸入: date -s 2007-08-03
只修改時間,輸入:date -s 14:15:00
同時修改日期時間,注意要加雙引號,日期與時間之間有一空格,輸入:date -s "2007-08-03 14:15:00"

修改完後,記得輸入:clock -w
把系統時間寫入CMOS

硬體時鐘:

hwclock --systohc set the hardware clock to the current system time

hwclock --httosys set the system time from hardware clock

hwclock --set

Linux(Redhat and Suse)change timezone:
1,在/usr/share/zoneinfo/目錄下查詢想要更換的時區名稱,修改格式同上
2,將原有的localtime檔案移走;
# mv /etc/localtime /etc/localtime-old
3,做新的localtime檔案,將對應的時區檔案連結過來
# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
4,與硬體同步
# /sbin/hwclock --systohc

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9907339/viewspace-1037859/,如需轉載,請註明出處,否則將追究法律責任。

相關文章