<p>When I do:</p>

<pre><code>$ find / 
</code></pre>

<p>It searches the entire system.<br>
How do I prevent that?</p>

<p>(This question comes from an "<a href="https://stackoverflow.com/questions/18836/why-doesnt-find-find-anything#26182">answer</a>" to another question.)</p>

[{'answer_id': 27080, 'author': 'Jon Ericson', 'author_id': 1438, 'author_profile': 'https://Stackoverflow.com/users/1438', 'pm_score': 0, 'selected': False, 'text': '<p>Use the <strong>-prune</strong> option.</p>\n'}, {'answer_id': 27084, 'author': 'Jon Ericson', 'author_id': 1438, 'author_profile': 'https://Stackoverflow.com/users/1438', 'pm_score': 2, 'selected': False, 'text': '<p>You might be better off using wildcards.  For instance, if you want to find all ksh scripts in the current directory:</p>\n\n<pre><code>$ ls *.ksh\n</code></pre>\n'}, {'answer_id': 27089, 'author': 'dmckee --- ex-moderator kitten', 'author_id': 2509, 'author_profile': 'https://Stackoverflow.com/users/2509', 'pm_score': 3, 'selected': False, 'text': '<p>Consider:</p>\n\n<pre><code>-maxdepth n\n             True if the depth of the current file into the tree is less than\n             or equal to n.\n\n-mindepth n\n             True if the depth of the current file into the tree is greater\n             than or equal to n.\n</code></pre>\n'}, {'answer_id': 27161, 'author': 'aib', 'author_id': 1088, 'author_profile': 'https://Stackoverflow.com/users/1088', 'pm_score': 0, 'selected': False, 'text': '<p>You may even do</p>\n\n<pre><code>echo /specific/dir/*.jpg\n</code></pre>\n\n<p>as it\'s your shell that expands the wildcard. Typing</p>\n\n<pre><code>ls *.jpg\n</code></pre>\n\n<p>is equivalent to typing</p>\n\n<pre><code>ls foo.jpg bar.jpg\n</code></pre>\n\n<p>given foo.jpg and bar.jpg are all the files that end with ".jpg" in the current directory.</p>\n'}, {'answer_id': 28262, 'author': 'Rob Wells', 'author_id': 2974, 'author_profile': 'https://Stackoverflow.com/users/2974', 'pm_score': 3, 'selected': True, 'text': '<p>G\'day,</p>\n\n<p>Just wanted to expand on the suggestion from Jon to use -prune. It isn\'t the easiest of find options to use, for example to just search in the current directory the find command looks like:</p>\n\n<pre><code>find . \\( -type d ! -name . -prune \\) -o \\( &lt;the bit you want to look for&gt; \\)\n</code></pre>\n\n<p>this will stop find from descending into sub-directories within this directory.</p>\n\n<p>Basically, it says, "prune anything that is a directory, whose name isn\'t ".", i.e. current dir."</p>\n\n<p>The find command evals left to right for each item found in the current directory so after completion of the first element, i.e. the prune segment, it will then continue on with the matched item in your second -o (OR\'d) expression.</p>\n\n<p>HTH.</p>\n\n<p>cheers,\nRob</p>\n'}]
['https://Stackoverflow.com/questions/27077', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1438/']