title: Does bash have a cache to remember where it last found a binary?
body: <p>Ok, so I am playing around in my system. I copied the GNU word count program:</p>
  
  <pre><code>cp /usr/bin/wc /usr/bin/wcx
  </code></pre>
  
  <p>and then I ran wc on a text file on my desktop and got the following, as expected:</p>
  
  <pre><code>53 79 907 /home/me/Desktop/mytextfile.txt
  </code></pre>
  
  <p>so far nothing out of the ordinary. I then delete (remove) wc</p>
  
  <pre><code>rm /usr/bin/wc
  </code></pre>
  
  <p>and the command returns with no terminal output. So it has been removed.</p>
  
  <p>Now at this point I should note that the PATH in this terminal is:</p>
  
  <pre><code>/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/bin:/sbin:/bin:/usr/games: [ETC]
  </code></pre>
  
  <p>Now when I run the same command:</p>
  
  <pre><code>wc /home/me/Desktop/mytextfile.txt
  </code></pre>
  
  <p>I get back:</p>
  
  <pre><code>bash: /usr/bin/wc: No such file or directory
  </code></pre>
  
  <p>Now, obviously it should not be able to find the wc binary as I deleted it. That is as expected. But the curious thing is that bash appears to have 'remembered' where on the PATH it last found the program as it has indicated that it can't find it in /usr/bin</p>
  
  <p>Is this an actual feature of bash? Is there a cache that, once it has searched the PATH for the binary once, it knows to return to that place for future requests of that binary?</p>
  
  <p>Thanks for helping to clear this up!</p>