Get Last Modified Date of File in Linux

3

This educational displays 3 easy tactics to get the closing changed date of a report in Linux. After studying this educational, you’ll understand how to test the closing amendment date of a report the use of the instructions ls, date, and stat.

Get Last Modified Date of a File in Linux with the command date

The first means to be informed the closing amendment date of a report in Linux defined on this educational specializes in the date command.  When the command date is adopted via the -r flag, it displays us the closing amendment date of a report.

The following instance displays the syntax to make use of the date command, the place linuxhint is the report whose closing amendment date I need to be revealed.

As you’ll be able to see, the output could be very user-friendly and comprises the date and time of the closing amendment carried out at the report.

For additional info at the date command, consult with https://man7.org/linux/man-pages/man1/date.1.html.

Get Last Modified Date of Files in Linux the use of the ls command

 The 2nd means defined on this educational explains get the closing changed date of a report the use of the ls command.

First, let’s use the ls command adopted via the -l flag, as proven within the screenshot under. The -l flag instructs the ls command to print an extended layout listing of information. The lengthy layout listing comprises the closing amendment date of a report.

Get Last Modified Date of File in Linux Get Last Modified Date of File in Linux 1630796648 752 Get Last Modified Date of File in Linux

As you’ll be able to see, the primary column displays the permissions, the second one and 3rd column displays report customers and teams. The fourth column is the scale. Then you’ll be able to see the month, day, and time wherein the report was once changed. Contrary to the former means with ls, you’re going to get an inventory of all information within the listing, together with their amendment dates.

For an ordered output, you’ll be able to upload the -t flag. The -t flag will print the output ordered via amendment date, appearing the closing changed information first, as proven within the following symbol.

Get Last Modified Date of File in Linux Get Last Modified Date of File in Linux 1630796648 100 Get Last Modified Date of File in Linux

As you’ll be able to see now, the closing changed information are actually proven first.

The ls command additionally permits you to take a look at the closing amendment date of a report in my opinion; for this, simply specify the report’s title as proven under.

Get Last Modified Date of File in Linux Get Last Modified Date of File in Linux 1630796649 401 Get Last Modified Date of File in Linux

As you’ll be able to see, this output is extra user-friendly in case you handiest need to take a look at a unmarried report.

You can get additional info at the ls command at its mane web page https://en.wikipedia.org/wiki/Ls.

Learn Last Modified Date of a File in Linux the use of stat

 The 3rd option to get the closing amendment date of a report in Linux defined on this article displays use the stat command for this goal.

The syntax is beautiful easy; simply run the stat command adopted via the report’s title whose closing amendment date you wish to have to understand, as proven within the instance under.

Get Last Modified Date of File in Linux Get Last Modified Date of File in Linux 1630796649 691 Get Last Modified Date of File in Linux

As you’ll be able to see, the output displays additional info than earlier instructions. It is vital to distinguish the amendment and alter dates.

The row named Modify displays us the closing time the report was once changed. The row named Change displays the closing time the standing of the report modified; the standing comprises permissions exchange, possession exchange, and many others.

You can run the command under to get within the output handiest the amendment time, omitting the remainder of the ideas.

Get Last Modified Date of File in Linux Get Last Modified Date of File in Linux 1630796650 562 Get Last Modified Date of File in Linux

As you spot, the output is restricted to the closing amendment date.

The stat command additionally permits us to test a number of information directly, as proven within the instance under, wherein information named linuxhint, and linuxhintfile are checked.

stat linuxhint linuxhintfile

Get Last Modified Date of File in Linux Get Last Modified Date of File in Linux 1630796651 977 Get Last Modified Date of File in Linux

Now we get knowledge at the two information we specified.

You can get additional info at the stat command at https://man7.org/linux/man-pages/man1/stat.1.html.

Conclusion

This educational displays that obtaining the closing changed date of a report in Linux can also be carried out thru other easy strategies. There is not any particular merit for any of the strategies defined; they all can also be carried out simply and with out putting in further programs. For this educational, I used Debian, however all instructions described listed below are to be had in all Linux distributions. All the instructions defined have further options you’ll be able to know via studying the person pages specified on the finish of each and every segment.

Thank you for following us; stay studying Linux Hint for added pointers and tutorials.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More