Look and check when the file was last modified by Linux. Here is how to check file last modified date in Linux and how to check last updated file in Linux.
There are three ways to do this:
- Using the ls command
- Using the statistics command
- Using the date command
1: Using the ls Command
When you use the ls command with the -l option, it displays the names of files and directories, along with information such as the date the file was modified.
Note that when you run the ls command without any arguments, it lists all files and folders in the current directory. But when you run the ls command on a file name, it only displays information about that particular file. Similarly, when you run the ls command on a directory name, it lists information about all the files in that particular directory.
Step 2: Using the stat Command
As you know, the stat command is used to check the status of a file and its details, such as the date the file was created and the date the file was last modified.
When you run the start command with the -c and ‘%y’ arguments, it will only show the last modified date.
Note that the -c flag is used to display data, and %y is used to display the last modification time.
Step 3: Using the date command
The last command that can be used to determine the modification date of a file is the date command. The date command with the -r option followed by a file name displays the date and time the file was last modified.