This article takes CentOS7
this as an example.
Directory structure of this article
date command
1 purpose
Display the current date.
2 Basic grammar
2.1 Display current date
date
2.2 Display the current year
date +%Y
2.3 Display the current month
date +%m
2.4 Display the current number
date +%d
2.5 Display year, month, day, hour, minute and second
date "+%Y-%m-%d %H:%M:%S"
2.6 Set date
date -s [字符串时间]
Example: Set the current time to2022-07-30 20:23:00
date -s "2022-07-30 20:23:00"
cal instruction
1 purpose
View calendar.
2 Basic grammar
2.1 Display this month’s calendar
cal
2.2 Display the calendar of the entire year
cal [年份]
Example: View 2022 Calendar
cal 2022