linux小练习1
1
1 [[email protected] ~]#date '+%F %H:%M:%S'
2019-04-16 12:16:54
或
[[email protected] ~]#date '+%Y-%m-%d %H:%M:%S'
2019-04-16 12:20:15
或
[[email protected] ~]#date '+%F %X' %T是系统时间时分秒 %X 是硬件时间的时分秒
2019-04-16 09:49:20 PM
2 [[email protected] ~]#date -d '-2 day' +%a
Sun 或
[[email protected] ~]#date -d '-2 day' +%A
Sunday
3
[[email protected] ~]#date -s '2019-08-07 06:05:10' > /dev/null && date "+%Y-%m-%d %H:%M:%S"
2019-08-07 06:05:10
或
date -s '2019-08-07 06:05:10'
或
[[email protected] ~]#date -s '2019-08-07 06:05:10'&& date '+%Y-%m-%d %H:%M:%S'
Wed Aug 7 06:05:10 CST 2019
2019-08-07 06:05:10
或
[[email protected] ~]#date +%s
1555444675
[[email protected] ~]#date [email protected] '+%Y-%m-%d %H:%M:%S'
2019-04-17 03:57:55