博客
关于我
Linux 学习命令之修改日期时间
阅读量:791 次
发布时间: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 UDP C/S例子
查看>>
Linux uniq学习笔记
查看>>
Linux unit14
查看>>
Linux VFS中write系统调用实现原理【转】
查看>>
Linux VI command
查看>>
linux vim 插件
查看>>
Linux vim 操作大集合,Linux运维工程师收藏!
查看>>
Linux vim编辑器
查看>>
LINUX weblogic集群搭建- 03启动脚本的控制
查看>>
Linux wget 下载 文件到指定目录
查看>>
linux who命令实现,用标准IO实现linux的who命令
查看>>
linux xampp php更改,Linux下xampp 安装php扩展(linux配置memadmin)
查看>>
Linux xfs和ext4的区别
查看>>
Linux yum-config-manager命令找不到的解决方法
查看>>
linux yum命令详解
查看>>
Linux yum在线安装软件包实战
查看>>
linux zip压缩排除目录,linux tar压缩排除某个文件夹的方法
查看>>
Linux —— 信号初识
查看>>
Linux —— 信号量
查看>>
Linux —— 信号(2)
查看>>