<p>I'm looking for shell scripts files installed on my system, but <strong>find</strong> doesn't work:</p>

<pre><code>$ find /usr -name *.sh
</code></pre>

<p>But I know there are a ton of scripts out there.  For instance:</p>

<pre><code>$ ls /usr/local/lib/*.sh
/usr/local/lib/tclConfig.sh  
/usr/local/lib/tkConfig.sh
</code></pre>

<p>Why doesn't <strong>find</strong> work?</p>

[{'answer_id': 18837, 'author': 'Jon Ericson', 'author_id': 1438, 'author_profile': 'https://Stackoverflow.com/users/1438', 'pm_score': 7, 'selected': True, 'text': "<p>Try quoting the wildcard:</p>\n\n<pre><code>$ find /usr -name \\*.sh\n</code></pre>\n\n<p>or:</p>\n\n<pre><code>$ find /usr -name '*.sh'\n</code></pre>\n\n<p>If you happen to have a file that matches <strong>*.sh</strong> in the current working directory, the wildcard will be expanded before find sees it.  If you happen to have a file named tkConfig.sh in your working directory, the <strong>find</strong> command would expand to:</p>\n\n<pre><code>$ find /usr -name tkConfig.sh\n</code></pre>\n\n<p>which would only find files named tkConfig.sh.  If you had more than one file that matches <strong>*.sh</strong>, you'd get a syntax error from <strong>find</strong>:</p>\n\n<pre><code>$ cd /usr/local/lib\n$ find /usr -name *.sh\nfind: bad option tkConfig.sh\nfind: path-list predicate-list\n</code></pre>\n\n<p>Again, the reason is that the wildcard expands to both files:</p>\n\n<pre><code>$ find /usr -name tclConfig.sh tkConfig.sh\n</code></pre>\n\n<p>Quoting the wildcard prevents it from being prematurely expanded.</p>\n\n<p>Another possibility is that /usr or one of its subdirectories is a symlink.  <strong>find</strong> doesn't normally follow links, so you might need the <strong>-follow</strong> option:</p>\n\n<pre><code>$ find /usr -follow -name '*.sh'\n</code></pre>\n"}, {'answer_id': 18843, 'author': 'Mark Harrison', 'author_id': 116, 'author_profile': 'https://Stackoverflow.com/users/116', 'pm_score': 4, 'selected': False, 'text': "<p>On some systems (Solaris, for example), there's no default action, so you need to add the -print command. </p>\n\n<pre><code>find /usr -name '*.foo' -print\n</code></pre>\n"}, {'answer_id': 476874, 'author': 'Colas Nahaboo', 'author_id': 58468, 'author_profile': 'https://Stackoverflow.com/users/58468', 'pm_score': 3, 'selected': False, 'text': '<p>For finding files on your disks, lean to use "locate" instead that is instantaneous\n(looks into a daily built index)\nyou example would be:</p>\n\n<pre><code>locate \'/usr*.sh\'\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/18836', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1438/']