{"id":228,"date":"2010-08-11T11:01:11","date_gmt":"2010-08-11T10:01:11","guid":{"rendered":"http:\/\/kb.toderu.ro\/?p=228"},"modified":"2010-08-11T11:01:11","modified_gmt":"2010-08-11T10:01:11","slug":"find-samples","status":"publish","type":"post","link":"https:\/\/kb.toderu.ro\/?p=228","title":{"rendered":"find samples"},"content":{"rendered":"<p>\t\t\t\tCan be OR&#8217;d or negated with -o  or -not<br \/>\n      find -user joe -not -group joe<br \/>\n      find -user joe -o -user jane<br \/>\n      find -not \\( -user joe -o -user jane \\) <\/p>\n<p>      Can match ownership by name or id<br \/>\n      find \/ -user joe -o -uid 500<br \/>\n      Can match octal or symbolic permissions<br \/>\n      find -perm 755<br \/>\n           matches if mode is exactly 755<br \/>\n      find -perm +222<br \/>\n           matches if anyone can write<br \/>\n      find -perm -222<br \/>\n           matches if everyone can write<br \/>\n      find -perm -002<br \/>\n           matches if other can write<\/p>\n<p>     Many find criteria take numeric values<br \/>\n      find -size 10M<br \/>\n            Files with a size of exactly 10 megabytes<br \/>\n      find -size +10M<br \/>\n            Files with a size over 10 megabytes<br \/>\n      find -size -10M<br \/>\n            Files with a size less than 10 megabytes<br \/>\n      Other modifiers are available such as k for KB, G for GB, etc.<\/p>\n<p>      find can match by inode timestamps<br \/>\n           -atime when file was last read<br \/>\n           -mtime when file data last changed<br \/>\n           -ctime when file data or metadata last changed<br \/>\n Value given is in days<br \/>\n           find \/tmp -ctime +10<br \/>\n           Files changed more than 10 days ago<br \/>\n Can use a value of minutes<br \/>\n            -amin<br \/>\n            -mmin<br \/>\n            -cmin<br \/>\n            find \/etc -amin -60<\/p>\n<p>      Commands can be executed on found files<br \/>\n            Command must be preceded with -exec or -ok<br \/>\n              -ok prompts before acting on each file<br \/>\n        Command must end with Space\\;<br \/>\n            Can use {} as a filename placeholder<br \/>\n            find -size +100M -ok mv {} \/tmp\/largefiles\/ \\; <\/p>\n<p>     Back up configuration files, adding a .orig extension<br \/>\n     $ find -name &#8216;*.conf&#8217; -exec cp {} {}.orig \\;<br \/>\n      Prompt to remove Joe&#8217;s tmp files that are over 3 days old<br \/>\n      $ find \/tmp -ctime +3 -user joe -ok rm {} \\;<br \/>\n      Fix other-writable files in your home directory<br \/>\n      $ find ~ -perm -002 -exec chmod o-w {} \\;<br \/>\n      Do an ls -l style listing of all directories in \/home\/<br \/>\n     $ find \/home -type d -ls<br \/>\n      Find files that end in .sh but are not executable by anyone. For each file, ask to make it executable by everyone<br \/>\n     $ find -not -perm +111 -name &#8216;*.sh&#8217; -ok chmod 755 {} \\;\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Can be OR&#8217;d or negated with -o or -not find -user joe -not -group joe find -user joe -o -user jane find -not \\( -user joe -o -user jane \\) Can match ownership by name or id find \/ -user joe -o -uid 500 Can match octal or symbolic permissions find -perm 755 matches if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,5],"tags":[],"class_list":["post-228","post","type-post","status-publish","format-standard","hentry","category-bash","category-linux"],"_links":{"self":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/posts\/228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=228"}],"version-history":[{"count":0,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/posts\/228\/revisions"}],"wp:attachment":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}