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
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9907339/viewspace-1037859/ ,如需转载,请注明出处,否则将追究法律责任。