Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My $PATH is set to a lot of directories including ~/bin and ~/target/bin

I want to execute which is in ~/target/bin but I get the error bash: ~/bin/ No such file or directory

This confuses me since which finds the correct directory ~/target/bin and ~/target/bin/ executes fine.

Are there any special settings in bash that could lead to this wrong path handling?

share|improve this question

migrated from May 7 '13 at 10:19

This question came from our site for professional and enthusiast programmers.

Please post command line and PATH content. You might have better luck asking on Superuser. – Stefano Sanfilippo May 7 '13 at 8:04
Does the script have execute permission? – Barmar May 7 '13 at 8:16
@Barmar yes it has. As mentioned the script executes with full path – Hachi May 7 '13 at 8:17
up vote 4 down vote accepted

You might try running hash -r to clear the executable cache.

Bash saves the location of the executable in a cache so it doesn't have to search the entire path again if you re-run the command. More on the hash command

share|improve this answer
that has helped; thank you very much. Could you please explain what this executable cache is? I've never heard of it before – Hachi May 7 '13 at 8:12
rehash in csh/tcsh – stevesliva Jun 25 '15 at 21:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.