博客
关于我
Linux 学习命令之修改日期时间
阅读量:792 次
发布时间:2023-02-01

本文共 708 字,大约阅读时间需要 2 分钟。

Linux 常用命令:修改日期时间


1. 查看当前时间与日期

你可以使用命令 date 查看系统当前的时间与日期:

[root@qdy ~]# date2017年 11月 03日 星期五 11:39:49 CST

或者使用 clock 命令:

[root@qdy ~]# clock2017年11月03日 星期五 11时42分52秒  -1.563496 seconds

此外,cal 命令可以显示月份的日历:

[root@qdy ~]# cal      2017年 November    1  2  3  4    5  6  7  8  9 10 1112 13 14 15 16 17 1819 20 21 22 23 24 2526 27 28 29 30

2. 设置系统时间与日期

如果需要将系统时间设置为指定日期和时间,可以使用 date -s 命令:

[root@qdy ~]# date -s 2017/11/032017年 11月 03日 星期五 00:00:00 CST

也可以将时间设定为特定的分钟数:

[root@qdy ~]# date -s 11:45:502017年 11月 03日 星期五 11:45:50 CST

3. 同步硬件时钟到系统时间

设置完成系统时间后,建议将时间同步到硬件时钟中,以防设备重启后的时间出错。可以使用 hwclock 命令:

[root@qdy ~]# hwclock -w

或者使用 clock 命令同步硬件时钟到系统时间:

[root@qdy ~]# clock --systohc

以上命令可以帮助你轻松修改系统日期和时间,同时确保时间准确无误。

转载地址:http://lawfk.baihongyu.com/

你可能感兴趣的文章
linux bash: sqlplus: command not found 错误处理
查看>>
linux bash中too many arguments问题的解决方法
查看>>
linux bg和fg命令
查看>>
Linux Bridge KVM虚拟化环境部署
查看>>
Linux Bridge(网桥)
查看>>
linux build编译,rpmbuild 编译
查看>>
linux C 中的volatile使用【转】
查看>>
linux c 正则
查看>>
Linux C/C++ 学习路线(已拿腾讯、百度 offer)
查看>>
Linux cat 命令的进化版:Bat 0.25 正式发布,行压缩功能亮点十足!
查看>>
linux centos tomcat8配置apr模式
查看>>
linux centos 安装 docker-compose 1.27.4
查看>>
linux centos6.4 php连接sql server2008
查看>>
Linux Centos7 xfsdump文件系统的备份和恢复
查看>>
Linux centos7 防火墙设置
查看>>
linux centos下 svn 版本控制服务器的搭建
查看>>
Linux CFSSL 生成证书
查看>>
linux chrom 系统无法读取用户偏好配置无需删除.config配置文件
查看>>
linux cmd using
查看>>
linux coreseek-4.1安装
查看>>