{"id":2219,"date":"2017-12-08T05:02:37","date_gmt":"2017-12-08T05:02:37","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2219"},"modified":"2022-04-24T04:17:48","modified_gmt":"2022-04-24T04:17:48","slug":"find-linux-command-collection","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/find-linux-command-collection\/","title":{"rendered":"Linux Tutorials: Find Command Examples and Use scnario"},"content":{"rendered":"<p><strong>rajeshkumar created the topic: Find Linux Command Collection<\/strong><br \/>\nFind files modified in the last 48 hours, and in current folder and one level below<br \/>\nI believe the correct command is `find -maxdepth 2 -type f -mtime -2<br \/>\n\u2022 maxdepth: will tell find to only search in the current folder<br \/>\n\u2022 type: will tell find to only list files and not directories<br \/>\n\u2022 mtime: will tell find to only list the files modified in the last 24 hours<\/p>\n<p>To find all files modified in the last 24 hours (last full day) in a particular specific directory and its sub-directories:<br \/>\nfind \/directory_path -mtime -1 \u2013print<\/p>\n<p>To find all files with regular file types only, and modified in the last 24 hours (last full day) in current directory and its sub-directories:<br \/>\nfind \/directory_path -type f -mtime -1 \u2013print<br \/>\nfind . -type f -mtime -1 \u2013print<\/p>\n<p>To find all files that are modified today only (since start of day only, i.e. 12 am), in current directory and its sub-directories:<br \/>\ntouch -t `date +%m%d0000` \/tmp\/$$<br \/>\nfind \/tmefndr\/oravl01 -type f -newer \/tmp\/$$<br \/>\nrm \/tmp\/$$<br \/>\nThe first command can be modified to specify other date and time, so that the commands will return all files that have changed since that particular date and time.<br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rajeshkumar created the topic: Find Linux Command Collection Find files modified in the last 48 hours, and in current folder and one level below I believe the correct command is&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[454],"tags":[460],"class_list":["post-2219","post","type-post","status-publish","format-standard","hentry","category-shell-script","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2219"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2219\/revisions"}],"predecessor-version":[{"id":29681,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2219\/revisions\/29681"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}