{"id":107,"date":"2009-04-23T21:22:55","date_gmt":"2009-04-24T02:22:55","guid":{"rendered":"http:\/\/www.gamescheat.ca\/?p=107"},"modified":"2019-09-04T19:57:41","modified_gmt":"2019-09-05T00:57:41","slug":"how-to-find-file-that-contains-a-specific-word-in-linux-and-unix","status":"publish","type":"post","link":"http:\/\/www.gamescheat.ca\/?p=107","title":{"rendered":"How to find file that contains a specific word in Linux and Unix."},"content":{"rendered":"<p>The find and grep command is very handy when searching for files that contains a specific word.  Both the find and grep commands are universal in Linux and Unix and the syntax is very similar.<\/p>\n<div style=\"float: right;\"><div style=\"margin: 15px 15px 15px 15px\";><script type=\"text\/javascript\"><!--\ngoogle_ad_client = \"pub-3319935785736004\";\ngoogle_alternate_color = \"FFFFFF\";\ngoogle_ad_width = 234;\ngoogle_ad_height = 60;\ngoogle_ad_format = \"234x60_as\";\ngoogle_ad_type = \"text_image\";\ngoogle_ad_channel =\"\";\ngoogle_color_border = \"cccccc\";\ngoogle_color_link = \"cc0000\";\ngoogle_color_bg = \"ffffff\";\ngoogle_color_text = \"000000\";\ngoogle_color_url = \"008000\";\n\/\/--><\/script>\n<script type=\"text\/javascript\"\n  src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\n<\/script><\/div><\/div><p>Below is an example.<\/p>\n<p>find \/home\/andrew -type f -exec grep -H \u2018networks\u2019 {} \\;<\/p>\n<p>This will display all files in the directory \/home\/andrew that contains the word networks abd output it to screen.<\/p>\n<p>Here is another example using the grep command alone.<\/p>\n<p>grep -r \u201cnetworks\u201d \/home\/andrew<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The find and grep command is very handy when searching for files that contains a specific word. Both the find and grep commands are universal in Linux and Unix and the syntax is very similar. Below is an example. find&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/www.gamescheat.ca\/?p=107\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19],"tags":[21,33,23,35],"_links":{"self":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/107"}],"collection":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=107"}],"version-history":[{"count":4,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions"}],"predecessor-version":[{"id":1008,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions\/1008"}],"wp:attachment":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}