See and check when file was last modified Linux. Here is how to check last file modified date in Linux and how to check last updates file in Linux
There are three ways to do this:
- Using ls command
- Using stat command
- Using date command
1: Using ls command
When you use ls command with its -l option, it displays the file and directory names along with details such as date when the file was modified.
Note that when you run ls command without any argument, it list all the files and folders in the current directory. But when you run the ls command with a file name, it will list the details of that specific file only. Similarly when you run the ls command with a directory name, it will list the details of all files in that particular directory.
2: Using stat command
As you know that stat command is used for checking a file status and its details such as date created and the last modified date of the file.
When you run the start command with -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 time of last modification.
3: Using date command
Last command which can be used to find the modification date of a file is date command. The date command with -r option followed by the name of file displays the last modified date and time of the file.