日常更新一些linux

This commit is contained in:
2026-07-01 22:02:35 +08:00
parent 26c9b207af
commit cd4a5a20ee
7 changed files with 82 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# date \[d] \[格式化字符串]
作用:按照给定的字符串显示日期,一般用于日期计算
参数:
- 格式化字符串:
- %Y年(1999,2026
- %y年份后两位数字(0099
- %M月份(0112
- %d日(0131
- %H小时(0023
- %M分钟(0059
- %S秒(0060
- %s自1970-01-01 00:00:00 UTC到现在的秒数
示例:
- date
- date +%Y-%m-%d
- date "+%Y-%m-%d %H:%M:%S"
+5
View File
@@ -0,0 +1,5 @@
# hostname
作用:查看主机名
# hostnamectl set-hostname \[主机名]
作用:更改主机名
+9
View File
@@ -0,0 +1,9 @@
# ntpdate \[u] \[地址]
作用:设置ntp服务
参数:
- u:指定ntp服务器
示例:
- ntpdate -u ntp.aliyun.com