Get Final Modified Date of a File in Linux with the command date
The initial technique to understand the last modification date of a file in Linux stated in this tutorial focuses on the day command. When the command day is followed by the -r flag, it demonstrates us the previous modification day of a file.
The following illustration displays the syntax to use the day command, where by linuxhint is the file whose previous modification date I want to be printed.
As you can see, the output is really person-friendly and features the date and time of the previous modification completed on the file.
For much more data on the day command, pay a visit to https://gentleman7.org/linux/man-web pages/guy1/day.1.html.
Get Very last Modified Day of Documents in Linux making use of the ls command
The next system spelled out in this tutorial describes how to get the previous modified date of a file employing the ls command.
To start with, let us use the ls command adopted by the -l flag, as revealed in the screenshot underneath. The -l flag instructs the ls command to print a prolonged format record of documents. The extended structure list features the previous modification date of a file.
As you can see, the first column shows the permissions, the second and 3rd column reveals file people and groups. The fourth column is the dimensions. Then you can see the thirty day period, working day, and time in which the file was modified. Opposite to the prior method with ls, you will get a list of all information in the directory, which includes their modification dates.
For an ordered output, you can include the -t flag. The -t flag will print the output requested by modification day, demonstrating the previous modified files initially, as revealed in the next image.
As you can see now, the last modified data files are now shown initially.
The ls command also makes it possible for you to check the final modification day of a file individually for this, just specify the file’s identify as demonstrated underneath.
As you can see, this output is much more consumer-welcoming if you only want to check out a one file.
You can get more facts on the ls command at its mane web page https://en.wikipedia.org/wiki/Ls.
Understand Very last Modified Date of a File in Linux employing stat
The 3rd system to get the past modification date of a file in Linux defined in this write-up displays how to use the stat command for this reason.
The syntax is very easy just run the stat command adopted by the file’s name whose previous modification day you want to know, as shown in the illustration beneath.
As you can see, the output shows a lot more data than previous commands. It is vital to differentiate the modification and adjust dates.
The row named Modify demonstrates us the very last time the file was modified. The row named Adjust shows the very last time the status of the file altered the standing incorporates permissions transform, ownership modify, and so on.
You can run the command beneath to get in the output only the modification time, omitting the relaxation of the data.
As you see, the output is limited to the last modification day.
The stat command also will allow us to test a number of data files at once, as revealed in the case in point below, in which information named linuxhint, and linuxhintfile are checked.
stat linuxhint linuxhintfile
Now we get information and facts on the two data files we specified.
You can get a lot more info on the stat command at https://guy7.org/linux/guy-pages/male1/stat.1.html.
This tutorial reveals that having the past modified date of a file in Linux can be carried out through various uncomplicated procedures. There is no exclusive benefit for any of the approaches spelled out all of them can be executed very easily and devoid of setting up added deals. For this tutorial, I used Debian, but all commands described listed here are offered in all Linux distributions. All the commands stated have further features you can know by reading through the male internet pages specified at the stop of every segment.
Thank you for pursuing us keep studying Linux Hint for added guidelines and tutorials.