In Linux systems, viewing the time of a file is a common and important operation that can be easily completed through the command line. In this article, we will introduce how to accurately view the time of a file under Linux system, and provide specific code examples.
The access time refers to the time when the file was last accessed. In Linux systems, you can use the stat
command to view the access time of a file. The specific command is as follows:
stat 文件路径
Example:
stat /path/to/file.txt
This command will output the detailed information of the file, including the access time.
The modification time refers to the time when the file was last modified. You can also use the stat
command to view the modification time of the file. The specific command is as follows:
stat -c %y 文件路径
Example:
stat -c %y /path/to/file.txt
This will output the modification time of the file.
The change time refers to the time when the file’s metadata (metadata) was last changed. You can also use the stat
command to view the change time of a file. The specific command is as follows:
stat -c %z 文件路径
Example:
stat -c %z /path/to/file.txt
This will output the change time of the file.
If you want to view the access time, modification time and change time of the file at one time, you can use the following command:
stat 文件路径
Example:
stat /path/to/file.txt
This will output all time information for the file, including access time, modification time, and change time.
Through the above method, we can accurately view the time information of files under the Linux system. In actual operation, you can select the corresponding time information as needed to view file changes, which is helpful for managing and maintaining files.
The above is the detailed content of How to accurately check the file time under Linux system?. For more information, please follow other related articles on the PHP Chinese website!