hash再構築は rehash じゃなくて hash -r

コマンドをアンインストールしたり、格納場所を変更したとき、一時的に command not found な状態になってしまうので、shellが保持している hash テーブルを再構築してあげる必要がある。


素直に Google 先生に聞いてみたところ。

>*Z.K. :
> I was trying to install gEda which installed fine from their CD, but
> after setting the path variables I ran rehash as the instructions told
> me and I get this error:
> bash: rehash: command not found
> Where is the rehash command and do I need to install some other package
> to get rehash to work? Or, is there an equivalent command to refresh
> the system variables?
> Z.K.
Bash doesn't have the rehash builtin command. Use "hash -r" instead
which is equivalent.

where is the rehash command - Unix Linux Forum - Fixunix.com


$ hash -r


man page

       hash [-lr] [-p filename] [-dt] [name]
              For  each  name,  the  full file name of the command is determined by searching the
              directories in $PATH and remembered.  If the -p option is supplied, no path  search
              is  performed,  and  filename is used as the full file name of the command.  The -r
              option causes the shell to forget all remembered locations.  The -d  option  causes
              the shell to forget the remembered location of each name.  If the -t option is sup-
              plied, the full pathname to which each name corresponds is  printed.   If  multiple
              name  arguments  are  supplied  with -t, the name is printed before the hashed full
              pathname.  The -l option causes output to be displayed in  a  format  that  may  be
              reused as input.  If no arguments are given, or if only -l is supplied, information
              about remembered commands is printed.  The return status is true unless a  name  is
              not found or an invalid option is supplied.