Skip to content
Related Articles

Related Articles

How to Get Last Modified Date of File in Linux?
  • Last Updated : 28 Mar, 2021

Here we are going to see how to get the last modified date of the file in Linux, sometimes we may require timestamps of the file and apart from this it also ensures that we have the latest version of that file.

It can be done in four ways:

  • Using Stat command.
  • Using date command.
  • Using ls -l command.
  • Using httpie

Example 1: Using Stat command.

Apart from this if you only want to see the modified date then use the below command

$ stat -c ‘%y’ filename

-c displays the date and %y displays the modification time.



Example 2: Using date command.

You can use the below command to display the last modification date of the file

$ date -r filename

Example 3: Using ls -l command:

The below command is used.

$ ls -lt filename

Example 4: Using httpie:

You can check the last modified date of the file which is residing on the webserver and the command is also used for interacting with HTTP servers and APIs.

Below syntax is used to check the last modified date of the file which is on the webserver.

$ http -h  [url] | grep 'Last-Modified'

My Personal Notes arrow_drop_up
Recommended Articles
Page :