1、date命令功能:date 可以用来显示或设定系统的日期与时间。

2、格式化输出[root@gongsi-A shell]# date "+%Y-%m-%d %H:%M:%S"2019-08-19 17:46:10

3、输出昨天日期[root@gongsi-A shell]# date -d '-1 days' '+%F'2019-08-18

4、设置具体时间[root@gongsi-A shell]# date -s "2012-05-23" Wed May 23 00:00:00 CST 2012

5、简单输出日期和时间%F %T参数[root@gongsi-A shell]# date "+%F %T"2012-05-23 00:01:12

6、使用date产生随机数[root@gongsi-A shell]# date +%N383871020[root@gongsi-A shell]# date +%N175733092
