date 时间查看命令
root@bk:~/ckh# date
Fri 06 Oct 2023 08:08:04 PM CST
root@bk:~/ckh# date +%Y%m%d
20231006
root@bk:~/ckh# date +%Y-%m-%d
2023-10-06
root@bk:~/ckh# date +%Y-%m-%d_%H
2023-10-06_20
root@bk:~/ckh# date +%Y-%m-%d_%H:%M:%S
2023-10-06_20:10:08
root@bk:~/ckh#
root@bk:~/ckh# date +%Y:%m:%d_%H:%M:%S
2023:10:06_20:10:29
# 时间拼接 `xxx` 需要先执行反撇号里面的 "命令"
root@bk:~/ckh# date +%Y%m%d
20231006
root@bk:~/ckh# touch log_`date +%Y%m%d`
root@bk:~/ckh# ls
5.txt 7.txt log_20231006 test.tar.gz
标签:-%,04,查看,ckh,bk,+%,日期,date,root
From: https://www.cnblogs.com/ckh2023/p/17745072.html