hash

Refresh the cached/remembered location of commands.
Logging out and in will refresh this automatically, but if you have just updated or reinstalled a package you may want to force an update.

Syntax
      hash [-lr] [-p filename] [-dt] [name]

Key
   -p   Use filename as the full file name of the command (no path search is performed).

   -t   Print the full pathname to which each name corresponds.

   -l   Display output in a format that may be reused as input.

   -d   Forget the remembered location of each name.

   -r   Forget all remembered locations.

For each name, the full file name of the command is determined by searching the directories in $PATH and remembered.

If multiple name arguments are supplied with -t, the name is printed before the hashed full pathname. 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.

Examples

Display the currently remembered location for getopt:
$ getopt
$ hash -t getopt

Remove the entry for getopt:
$ hash -d getopt

hash is a bash built in command: $ help hash

“Remember me when I am gone away, Gone far away into the silent land...” - Christina Georgina Rossetti

Related:

history - Command History



Back to the Top

© Copyright SS64.com 1999-2012
Some rights reserved