Home > Article > Operation and Maintenance > How to query the modification time of a file in Linux
How to query the file modification time in Linux: 1. Execute the "stat filename" command, and the "Modify Time" item information of the output result is the modification time; 2. Execute the "ls -l filename" command, and the output result is Change the time.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
Modification time (modifytime): Modify the file content once and the time will be updated.
For example, after using vim and other tools to change the file content and save it, the file modification time changes.
Linux query file modification time
1. stat command
Use Run the stat filename
command to view the file. As shown in the figure,
will display three times:
Access Time: The abbreviation is atime, which represents the access time of the file. When the file content is accessed, this time is updated
Modify Time: Abbreviated as mtime, which represents the modification time of the file content. When the data content of the file is modified, this time is updated.
Change Time: Abbreviated as ctime, it represents the status time of the file. When the status permission of the file is modified, this time is updated, such as the number of links, size, permissions, and number of Blocks of the file. .
Among them, modify generally represents the modification time. We can test it experimentally
echo "This is a test">>123.txt
See that the file Modify Time modification time has occurred Change
2, ls command
ls -l
command to view the file, the default view It is mtime, which is the most recent modification time of the file
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to query the modification time of a file in Linux. For more information, please follow other related articles on the PHP Chinese website!