Home  >  Article  >  Operation and Maintenance  >  How to query the modification time of a file in Linux

How to query the modification time of a file in Linux

青灯夜游
青灯夜游Original
2021-12-21 17:32:4927485browse

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.

How to query the modification time of a file in Linux

#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,

How to query the modification time of a file in Linux

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. .

How to query the modification time of a file in Linux

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

How to query the modification time of a file in Linux

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

How to query the modification time of a file in Linux

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn