Checking File Modification Time
To check the modification time of a file in Linux, you can use the ls
command with the -l
option to display the file details, including the modification time.
ls -l file.txt
This will output something like:
-rw-r--r-- 1 user user 0 Apr 24 12:34 file.txt
The modification time is displayed in the format MMM DD HH:MM
, where MMM
is the abbreviated month name, DD
is the day of the month, and HH:MM
is the time in 24-hour format.
Alternatively, you can use the stat
command to display more detailed information about a file, including the modification time.
stat file.txt
This will output something like:
File: file.txt
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd00h/64768d Inode: 12345678 Links: 1
Access: (0644/-rw-r--r--) Uid: (1000/ user) Gid: (1000/ user)
Access: 2023-04-24 12:34:56.789012345 +0000
Modify: 2023-04-24 12:34:56.789012345 +0000
Change: 2023-04-24 12:34:56.789012345 +0000
Birth: -
The Modify
field shows the modification time of the file.
You can also use the date
command to display the modification time in a more human-readable format.
date -r file.txt
This will output something like:
Mon Apr 24 12:34:56 UTC 2023