Home > Operation and Maintenance > Linux 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

青灯夜游
Release: 2021-12-21 17:32:49
Original
27547 people have browsed it

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template