EN
Bash - get file modification, access and change times
10
points
In this short article, we would like to show how to get a modification, access, and change times for any file under Bash / Linux.
Quick solution (run the following command):
stat path/to/file.txt
Example output:
File: path/to/file.txt
Size: 4 Blocks: 8 IO Block: 4096 regular file
Device: 801h/2049d Inode: 37752 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2021-09-14 13:10:32.089482633 +0200
Modify: 2021-09-14 13:10:46.558002340 +0200
Change: 2021-09-14 13:11:30.923595933 +0200
Birth: -
Where:
Access: 2021-09-14 13:10:32.089482633 +0200
indicates the time when the file was accessed last time,Modify: 2021-09-14 13:10:46.558002340 +0200
indicated the time when file content was changed last time (e.g. some data was written),Change: 2021-09-14 13:11:30.923595933 +0200
indicates the time when file metadata was changed last time (e.g. file name was changed).