Set the time
[[email protected]/]# date-s "20171014 15:42:00"
Saturday, October 14, 2017 15:42:00 CST
Format time
[[Email protected] ~]# Date
Sat Oct 09:07:29 CST 2017
[Email protected] ~]# date +%y-%m-%d
17-10-14
[Email protected] ~]# date +%y-%m-%d
2017-10-14
[Email protected] ~]# date +%f
2017-10-14
[Email protected] ~]# date +%w #星期几
6
[Email protected] ~]# date +%y-%m-%d\%h:%m:%s
2017-10-14 09:19:44
[[Email protected] ~]# date +%f\%x
2017-10-14 09:20:01
[Email protected] ~]# date +%f\%T
2017-10-14 09:21:02
[Email protected] ~]# date +%y_%m_%d #间隔符
2017_10_14
-------------------------------------------
Packaged
[Email protected] data]# tar zcvf girl.tar.gz./girl
./girl/
./girl/del.sh
./girl/mygirl
[Email protected] data]# ls-l girl*
-rw-r--r--1 root root 221 Oct 09:24 girl.tar.gz
Add time.
[Email protected] data]# tar zcvf girl_ ' date +%f '. tar.gz./girl
./girl/
./girl/del.sh
./girl/mygirl
[Email protected] data]# tar zcvf girl_$ (date +%f). tar.gz./girl
./girl/
./girl/del.sh
./girl/mygirl
Results:
-rw-r--r--1 root root 221 Oct 09:27 girl_2017-10-14.tar.gz
--------------------
View previous days
[[Email protected] data]# date +%f-d " -1day"
2017-10-13
[[Email protected] data]# Date
Sat Oct 09:37:19 CST 2017
[[Email protected] data]# date +%f-d "+2day"
2017-10-16
[[Email protected] data]# date +%f-d "+24hour"
2017-10-15
--------------------
After packaging the 24H
[Email protected] data]# tar zcvf girl_$ (date +%f-d "1day"). tar.gz./girl
./girl/
./girl/del.sh
./girl/mygirl
----------------------
Support ' Points '
[[Email protected] data]# date +%f-d "+1440min"
2017-10-15
[Email protected] data]# date +%f
2017-10-14
----------
10.14-linux setup Time, etc.