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):
xxxxxxxxxx
1
stat path/to/file.txt
Example output:
xxxxxxxxxx
1
File: path/to/file.txt
2
Size: 4 Blocks: 8 IO Block: 4096 regular file
3
Device: 801h/2049d Inode: 37752 Links: 1
4
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
5
Access: 2021-09-14 13:10:32.089482633 +0200
6
Modify: 2021-09-14 13:10:46.558002340 +0200
7
Change: 2021-09-14 13:11:30.923595933 +0200
8
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).