The date command is a common command in Linux, and the main function is to display the current time of the machine. As follows:
In my Linux operating system, the date command is implemented by default in the format of month-day-week-hour, and then CST Central Standard Time. However, you can also modify the display format yourself, such as:
which
1, Year: +%y indicates that the year is printed in four-digit format, whereas +%y indicates that the year is printed in two-digit format;
2, Month: +%m the month;
3, Date: +%d represents the date (days);
4, When: +%h represents the hour;
5, minute: +%m means minutes;
6, seconds: +%s = seconds;
7, Week: +%w represents the week, 1-6 for Monday to Saturday, 0 for Sunday, W for today's first few full weeks, so the result is 1 or 13.
The application of the date command is much more than that, and there are applications such as the following:
1, get a day ago Date: date-d "-1 days" +%d
2, get an hour ago: date-d "1 hour" +%h
3, get a minute ago: date-d "1 min" +%m
4, get a month before the time: date-d "-1 month"
5, get a year ago time: date-d "-1 Years"
6, get a week ago Time: date-d "1 Week"
Linux Date Command