AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Unix find files by date modified4/17/2023 To find all the files modified in last 10 minutes, we need to use the find command with -nmin option and numeric argument will 10. Output: 512772 4 -rw-rw-r- 1 ubuntu ubuntu 2 Jan 16 16:35 myapp/config.iniĥ12820 4 -rw-rw-r- 1 ubuntu ubuntu 2 Jan 16 16:35 myapp/sample.log Linux: Find files changed in last 10 minutes For example, find myapp/ -type f -mmin -5 -ls If you want the complete details of the files, then append the ‘ls’ command too. The option ‘-type f’ is to make sure that it selects the files only, if also you want to see the directories which are modified in last 5 minutes, then you can skip this option. You can change the folder path based on your requirements. It is important to specify the -ve sign along with 5 because then only it will look for files modified in last 5 minutes. It recursively search for the files inside folder myapp/ and returned all the files which are modified in last 5 minutes. More details about the -nmin option of find command is as follows, It will recursively look for the files which are modified less than, more than or exactly n minutes ago in the given directory. One such option is “-mmin n”, it helps to recursively search files by modified time, Syntax of find command with “-mmin n” option find -type f -nmin n It also provides various options to do the selective search. The find command in Linux, provides an easy way to search files recursively in a directory hierarchy. For this, we can easily use the find command in Linux. In such scenarios we need to search files by the last modified time. Now, these last few minutes can be the last 5 minutes or last 30 minutes or last N minutes. Many times, we encounter the scenarios where we need to find files which are modified in last few minutes.
0 Comments
Read More
Leave a Reply. |