wiki/运维/操作系统/Linux/笔记/5.时间管理.md
2025-01-02 10:46:09 +08:00

39 lines
952 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### 日期和时间
Linux的时钟分为两种
- 系统时钟由Linux内核通过CPU的工作频率控制
- 硬件时钟:主板上的时间
###### date命令
```shell
参数:
-r #显示文件上次修改的时间
-d #时间转换
-s #设置时间
date +"%F %T"
format输出的时间格式。
%F 完整的日期;等价于%+4Y-%m-%d
%Y 年
%m 月
%d 日
%T 时间;等价于%H:%M:%S
%H 小时
%M 分钟
%S 秒
```
```shell
[root@tencentos ~]# clock
2023-11-26 00:12:24.485439+08:00
```
```shell
Commands:
status Show current time settings
show Show properties of systemd-timedated
set-time TIME Set system time
set-timezone ZONE Set system time zone
list-timezones Show known time zones
set-local-rtc BOOL Control whether RTC is in local time
set-ntp BOOL Enable or disable network time synchronizatio
```