Linux Command date
Date
1. query system time
2.-d is followed by characters to query the time of a specific condition, such as 3 days ago, 2 days later, 5 minutes later, 6 seconds ago, etc.
Date-d '2 day ago 'two days ago
Date-d '3 year' three years later
Date-d '1 year 3 day ago 5 hour 5 min 5 sec '3 days before 05:05:05 a year later
3.-s: set the system time
Date-s 12/31/2015 set year month day
Date-s 22:05:20 set the time
You need to set it in two steps. You do not know how to set it once.
Another problem is to change the default time display format of the system. This is unknown and may be related to the locale command.
4. + % Y % m % d set the display format
% Y 1999 full year
% Y 99-year ending count
% M December
% D 31 days
% H 24 hour
% I 12 12 hour
% M 60 points
% S 60 seconds
% W weeks 0-7
Combination Method % D % y/% m/% d
% F % Y-% m-% d
% T % H: % M: % S
[Root @ wjf ~] # Date + % Y _ % m _ % d ___ % H: % M: % s2014_12_021__00: 26: 05
5. -r is followed by a file name, which can display the last modification time of the file. It is very useful. You can use this method to extract the modification time of the file to delete the file in a specific time period in shell.
[Root @ wjf ~] # Date-r db2exp. rsp Monday 1, November 24, 2014 18:13:57 CST [root @ wjf ~] # Ll db2exp. rsp-rw-r -- 1 root 1667 11-24 18:13 db2exp. rsp