linux View the current system time, modification time, and file time
linux View the current system time, modification time, view file time, etc.
1. View the time and date
2. Set the time and date
For example: command to set the system date to June 8, 2018
: "date -s 06/08/2018"
The command to set the system time to
10:46:03 PM Command: "date -s 10:46:03"
3. View the time zone: date -R
4. Query the current date of the system: $ date + "%Y-%m-%d"
Note: The plus sign must have a space with date, and no space with %Y, and must be enclosed in double quotation marks; also pay attention to the case. Uppercase Y is the year, lowercase m is the month, and the uppercase M is the minute. Lowercase d for days.
5. Query the current time of the system: $ date +"%H-%M-%S"
Note: Capital S for seconds
6. View the file time (ls -l or ll)
When viewing files under Linux, ls -l does not display seconds by default:
To display seconds (actually more precise), you can use the --full-time parameter:
To display more information, use the stat command:
If there is something wrong, please correct me, learn from each other, and make progress together.