Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

I am having a weird issue in FreeBSD9 using csh as my shell. Newly installed programs that are in my path will only launch if I relaunch the csh shell. I find this really annoying.

I guess csh searches paths once and doesn't re-search them until you exit it. How do you force it to update itself? Is there something you can put in the .cshrc to make it stop doing this? (I'm used to bash, and I don't see anything like this going on in bash.)

share|improve this question
up vote 3 down vote accepted

The Unix C shell hashes your search path directories to help it find executables faster. But it develops blind spots if you add new executables to those directories after it's already done its hash. The solution is to use the rehash command to tell it to rebuild its hash. Alternately, you can turn off the path hash entirely (taking a slight performance hit) using the unhash command.

(Fwiw, I agree this is annoying behavior. I use a path hash in my own Hamilton C shell, but mine is smart enough to discover blind spots and repair them automatically.)

share|improve this answer
It surprises me that each instance of the shell has its own hash. I guess each shell MIGHT have its own different path, even if the same .cshrc created the initial path, so I guess that's inevitable. – Warren P Nov 19 '12 at 14:29
The hash is created in memory by each instance of the C shell as it scans the path directories. Bear in mind that every process gets its own copy of the environment variables (including PATH) and can change them without affecting other processes. – Nicole Hamilton Nov 19 '12 at 16:02
I remember reading an article about your shell in DDJ, in the early 1990s. I think it was this one: OS/2... Wow. Memories. – Warren P Nov 19 '12 at 17:06
Yup, that's my C shell. I had a different first name then but that's me. Who knew that 25 years later I'd still be working on it, still adding features and support for new releases of Windows. – Nicole Hamilton Nov 19 '12 at 17:25
Nice! I tried the x64 demo version on Win8 RTM just now. I am happy to report it seems to run just fine. Some feedback: I miss having "man" when running in this environment, as compared to cygwin. I can't get far in BSD-like shell environments without man. And ssh. And this thermos, and this paddle-ball game. And that's ALL I need. :-) – Warren P Nov 19 '12 at 18:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .